2012-04-12 149 views
0

我想隐藏EditText上的软键盘,即使在'点击'时也是如此。我的意思是说在我的活动中不应该有可见的软键盘,因为我有自己的键盘来输入数据。 请帮我...谢谢...如何隐藏EditText上的软键盘

+1

可能重复[How t o关闭/隐藏Android软键盘?](http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard) – 2012-04-12 10:20:54

+0

@Adil Soomro,我无法获得从该链接解决方案...仍然软键盘是可见的,当我点击edittext ... – Noundla 2012-04-12 11:02:51

+0

看到这篇文章http://stackoverflow.com/a/1109108/985143 – 2012-04-12 10:16:05

回答

3
editText_input_field.setOnTouchListener(otl); 

private OnTouchListener otl = new OnTouchListener() { 
public boolean onTouch (View v, MotionEvent event) { 
     return true; // the listener has consumed the event 
} 
}; 

来源:how to block virtual keyboard while clicking on edittext in android?

+1

这是很好的,在这里我们必须把重点放在指定的视图,这就是为什么我们必须得到这个请求。所以最好在上面加上'((EditText)v).requestFocus()'return true;' – Noundla 2012-04-12 11:27:30

+0

没有@Noundla的评论编辑框将不会专注于触摸 – 2017-04-18 23:59:00

1

设置的EditText小部件的的inputType到null这样,

editTExt.setInputType(TYPE_NULL); 
+0

什么是TYPE_NULL? – Noundla 2012-04-12 11:05:53

+0

@noundla ..它在** InputType **类中的一个常量..尝试** InputYpe.TYPE_NULL ** – ngesh 2012-04-12 11:08:03

+0

行..它是工作正常的唯一已经焦点的编辑文本..如果我移动到另一个编辑文本那么softkeyboard来... – Noundla 2012-04-12 11:14:43

0

粘贴如下代码下的EditText XML文件标签

android:textIsSelectable="true"