本文介绍了键盘的EditText是dissappearing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个的LinearLayout 的EditText
和按钮
。当点击到按键,我在布局中删除所有的意见和添加另一种观点。当后退按钮是pressed我删除所有的意见,并再次加入EDITTEXT和按钮。现在,当我触摸EDITTEXT,键盘不可见!我想,也许这是一个焦点问题。如何处理这个问题?
I have an EditText
and a Button
in LinearLayout. When clicked to button, I am removing all views in layout and adding another view. When back button is pressed I am removing all views and adding editText and Button again. Now when I touch on editText, keyboard does not become visible! I think maybe it is a focus issue. How can handle this problem?
推荐答案
试试这个code,它会为你工作。
Try this code, it will work for you.
InputMethodManager m = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if(m != null){
m.toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT);
}
这篇关于键盘的EditText是dissappearing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!