0
可能重複:
Is there a way to tell if the soft-keyboard is shown?如何勾選SoftKeyboard顯示在活動屏幕上?
在一種應用我想要查詢Softkeyboard顯示在活動屏幕上。
plz幫助
可能重複:
Is there a way to tell if the soft-keyboard is shown?如何勾選SoftKeyboard顯示在活動屏幕上?
在一種應用我想要查詢Softkeyboard顯示在活動屏幕上。
plz幫助
有一個解決辦法,如果你有興趣,你可以使用getCurrentFocus()
返回其處於焦點的觀點,並檢查它的EditText的實例,如果是,那麼你知道softkeyboard可見,提供了軟鍵盤中的主要輸入,而不是物理鍵盤。
protected boolean IsSoftKeyboardVisible(){
if(getCurrentFocus()!=null && getCurrentFocus() instanceof EditText){
return true;
}
return false;
}
我想我們可以顯示和隱藏軟鍵盤,但是我們無法獲得軟鍵盤的可見性狀態。 – sankar
走[這個問題](http://stackoverflow.com/questions/3568919/android-how-can-i-tell-if-the-soft-keyboard-is-showing-or-not),它顯示爲儘管無法檢查。 – Closeratio