Keyboard not shown when i click on edittextview in android?(在android中单击edittextview时未显示键盘?)
问题描述
当我点击 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时未显示键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在android中单击edittextview时未显示键盘?


- Android - 拆分 Drawable 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01