在android中单击edittextview时未显示键盘? [英] Keyboard not shown when i click on edittextview in android?

查看:19
本文介绍了在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时未显示键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆