我想隱藏EditText上的軟鍵盤,即使在'點擊'時也是如此。我的意思是說在我的活動中不應該有可見的軟鍵盤,因爲我有自己的鍵盤來輸入數據。 請幫我...謝謝...如何隱藏EditText上的軟鍵盤
0
A
回答
3
editText_input_field.setOnTouchListener(otl);
private OnTouchListener otl = new OnTouchListener() {
public boolean onTouch (View v, MotionEvent event) {
return true; // the listener has consumed the event
}
};
來源:how to block virtual keyboard while clicking on edittext in android?
+1
這是很好的,在這裏我們必須把重點放在指定的視圖,這就是爲什麼我們必須得到這個請求。所以最好在上面加上'((EditText)v).requestFocus()'return true;' – Noundla 2012-04-12 11:27:30
+0
沒有@Noundla的評論編輯框將不會專注於觸摸 – 2017-04-18 23:59:00
1
0
粘貼如下代碼下的EditText XML文件標籤
android:textIsSelectable="true"
可能重複[How t o關閉/隱藏Android軟鍵盤?](http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard) – 2012-04-12 10:20:54
@Adil Soomro,我無法獲得從該鏈接解決方案...仍然軟鍵盤是可見的,當我點擊edittext ... – Noundla 2012-04-12 11:02:51
看到這篇文章http://stackoverflow.com/a/1109108/985143 – 2012-04-12 10:16:05