SearchView setIconified(false) automatically calls the focus for the searchview. How can I disable this?
Try this:
searchView.setFocusable(false);
searchView.setIconified(false);
searchView.clearFocus();
Programmatically remove all the fields like
searchView.setFocusable(false);
searchView.setIconified(false);
searchView.clearFocus();
and set through xml attributes for serach view:
<!-- Dummy item to prevent Search view from receiving focus -->
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component
to prevent the dummy from receiving focus again -->
<android.support.v7.widget.SearchView android:id="@+id/serach_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusUp="@id/serach_view"
android:nextFocusLeft="@id/serach_view"/>
It will work.
check this link for reference enter link description here