本文介紹了Android:在所有 EditTexts 禁用軟鍵盤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在使用一些 EditText
在 Android 上開發一個對話框.我已將此行放在 onCreate()
以禁用軟鍵盤:
I am working on a dialog at Android with a few EditText
s.
I've put this line at the onCreate()
in order to disable the soft keyboard:
Keypad.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
問題是它僅在對話框出現并且什么都不做時才起作用.當我移動到下一個 EditText
時,鍵盤出現并且沒有按下.
The problem is that it works only when the dialog appear and doing nothing.
When I move to the next EditText
, the keyboard appears and not going down.
有人知道如何解決這個問題嗎?
Does anybody have an idea how to solve this issue?
推薦答案
創建你自己的類來擴展 EditText
并覆蓋 onCheckIsTextEditor()
:
create your own class that extends EditText
and override the onCheckIsTextEditor()
:
public class NoImeEditText extends EditText {
public NoImeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onCheckIsTextEditor() {
return false;
}
}
這篇關于Android:在所有 EditTexts 禁用軟鍵盤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!