(求助)editText焦点监听不起作用
想对一个editText做焦点监听,在输入完后,点击其他地方自动隐藏输入法
editText.setOnFocusChangeListener(new android.view.View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
//焦点变化
});
但是一直没有跑到onFocusChange里面,这个是什么问题?
或者有什么好办法实现输入完后,焦点不再editText的时候自动隐藏输入法吗?
------解决思路----------------------
在布局文件中增加父控件属性android:focusable="true"试一下呢
------解决思路----------------------
引用:在布局文件中加了android:focusable="true"也不管用,还是没有跑到onFocusChange。
我的EDITTEXT是一个搜索输入框,做一个百度地图的应用,输入完后想实现点击其他地方隐藏输入法
我测试了一下
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linear"
android:layout_width="match_parent"
android:layout_height="