當前位置:首頁 » 安卓系統 » androidedittext鍵盤

androidedittext鍵盤

發布時間: 2022-05-04 17:27:26

Ⅰ 在android中點擊EditText的時候會彈出軟鍵盤,這時候如果想隱藏軟鍵盤或者填完內容後點其他的地方直接隱藏

1)在Manifest.xml文件中相應的activity下添加一下代碼:
android:windowSoftInputMode="stateHidden"

2)讓EditText失去焦點,使用EditText的clearFocus方法
例如:EditText edit=(EditText)findViewById(R.id.edit);
edit.clearFocus();

3)強制隱藏Android輸入法窗口
例如:EditText edit=(EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(),0);

4).EditText始終不彈出軟體鍵盤
例:EditText edit=(EditText)findViewById(R.id.edit);
edit.setInputType(InputType.TYPE_NULL);

Ⅱ android editText 如何自動顯示軟鍵盤

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
//隱藏軟鍵盤
// imm.hideSoftInputFromWindow(editView.getWindowToken(), 0);
//顯示軟鍵盤
// imm.showSoftInputFromInputMethod(editView.getWindowToken(), 0);
//切換軟鍵盤的顯示與隱藏
imm.toggleSoftInputFromWindow(editView.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);

Ⅲ android 有一行edittext 輸入數字,如何設置數字鍵盤輸完一個按enter鍵接著

EditTextet=(EditText)findViewById(R.id.editNum);et.setInputType(InputType.TYPE_CLASS_NUMBER);給你的EditText設置輸入類型TYPE_CLASS_NUMBER,這樣你在點擊EditText的時候,默認彈出的鍵盤模式就是數字鍵盤。

Ⅳ Android ListView下方放一個EditText,軟鍵盤彈出問題。

找到問題原因了,是因為我的ListView設置了android:transcriptMode="alwaysScroll"屬性,去掉就好了。
android:windowSoftInputMode設置為"stateHidden|adjustUnspecified"其實在我這里adjustUnspecified應該等價於ReSize吧
沒做實驗驗證。恩,總之,謝謝大家了。

Ⅳ Android的EditText在怎樣獲取焦點並彈出軟鍵盤

  1. //讓編輯框彈出來,並顯示對誰進行評論

  2. commentEditText.setFocusable(true);

  3. commentEditText.setFocusableInTouchMode(true);

  4. commentEditText.requestFocus();

  5. //打開軟鍵盤

  6. InputMethodManagerimm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);

  7. imm.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);

  8. //讓編輯框彈出來,並顯示對誰進行評論
    commentEditText.setFocusable(true);
    commentEditText.setFocusableInTouchMode(true);
    commentEditText.requestFocus();
    //打開軟鍵盤
    InputMethodManagerimm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);上面的代碼,能夠讓EditText獲取焦點,並彈出軟鍵盤,供輸入文本內容。特別適用於評論列表之類的場景。

Ⅵ android開發EditText輸入時彈出數字輸入鍵盤

一共有兩種方法:
1.可以直接在布局文件中設置輸入文本類型為數字
<EditText

android:id="@+id/editview"

android:layout_width="match_parent"

android:layout_height="wrap_content"
android:inputType="number"
android:hint="請輸入數字"/>
2.代碼設置:
( EditText) et = (EditText) findViewById(R.id.editview);
ed.setInputType(InputType.TYPE_CLASS_NUMBER);

熱點內容
陳赫超級訪問完整版 發布:2025-07-21 07:35:01 瀏覽:288
ios微信反編譯 發布:2025-07-21 07:34:24 瀏覽:28
thelinuxkernel 發布:2025-07-21 07:23:28 瀏覽:558
安卓刷機和線刷有什麼區別 發布:2025-07-21 07:16:23 瀏覽:242
炫舞節奏腳本 發布:2025-07-21 06:59:55 瀏覽:578
xlsx表格保護密碼忘記如何處理 發布:2025-07-21 06:33:57 瀏覽:659
兒童密碼日記本的通用密碼是什麼 發布:2025-07-21 06:28:31 瀏覽:234
移動默認pppoe密碼是什麼 發布:2025-07-21 06:28:28 瀏覽:711
工資表資料庫 發布:2025-07-21 06:22:54 瀏覽:694
c語言青蛙過河 發布:2025-07-21 06:22:47 瀏覽:786