当MultiAutoCompleteTextView被点击并获得焦点时,需要做一些事情,但是侦听器似乎没有被调用。知道为什么吗?下面是代码:
searchbar.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if(b) hide();
else Utils.closeKeyboard(MapsActivity_v2.this, view);
}
});
<MultiAutoCompleteTextView
android:imeOptions="actionDone"
android:id="@+id/searchbar"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/search_hint"
android:padding="6dp"/>发布于 2017-09-01 13:31:22
添加XML:
android:focusable="true"
android:focusableInTouchMode="true"代码工作正常。
https://stackoverflow.com/questions/46001216
复制相似问题