0
當MultiAutoCompleteTextView被輕敲並獲得焦點時,需要做一些工作,但似乎偵聽器沒有被調用。任何想法爲什麼?下面的代碼:MultiAutoCompleteTextView不會調用onFocusChanged()
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"/>
已經試過了,還沒有正常工作 –
是父佈局是LinearLayout ?? – Zoffa
RelativeLayout –