問題描述
當我點擊 edittextview 時,有時會顯示鍵盤或有時不顯示鍵盤.
When i click on the edittextview then some times keyboard shown or some times keyboard are not shown.
在 android 2.1 中,當我點擊 edittextview 時它會顯示鍵盤
In android 2.1 it show the keyboard when i click on the edittextview
但是當我在 android 2.2 上啟動相同的應用程序時,它不會顯示鍵盤.
but when i start same application it on android 2.2 then it not show the keyboard.
幫助我如何展示這個問題.
Help me how to show that problem.
推薦答案
好的,這可能是一個遲到的響應,但它有效.
OK, This might be a late response, but it worked.
我在 android 2.1 和 2.3.x 上遇到過這個問題(未在其他版本的 SDK 上測試過).
I have met this problem on android 2.1 and 2.3.x(not tested on other versions of SDKs).
我注意到一個奇怪的事情,當我單擊 EditText 時無法打開鍵盤,我按下 BACK 按鈕以顯示一個警告對話框,然后我取消(關閉)它,然后再次單擊 EditText,現在是鍵盤又復活了.
I noticed a strange thing that when my click on the EditText was unable to open the keyboard, I pressed the BACK button to show an alert dialog and then I canceled(closed) it, and clicked the EditText again, now the keyboard was brought to life again.
由此我可以得出結論,如果 EditText 以前沒有自己的焦點,則鍵盤將始終顯示 EditText(在 EditText 視圖上顯示警告對話框將使 EditText 失去焦點).
From that I can conclude that the keyboard will always show for the EditText if the EditText does not previously own focus(showing an alert dialog over the EditText view will make the EditText to lose focus).
所以當它被帶到前面時,在你的 EditText 上調用下面的函數:
so call the function below on your EditText when it is brought to front:
mEditText.clearFocus();
或
parentViewThatContainsEditTextView.clearFocus();
這篇關于在android中單擊edittextview時未顯示鍵盤?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!