I have the following code:
if(mSearchView != null){
mSearchView.setIconifiedByDefault(false);
mSearchView.setIconified(false);
mSearchView.setOnQueryTextListener(this);
int searchPlateId = mSearchView.getContext().getResources()
.getIdentifier("android:id/search_plate", null, null);
View searchPlateView = mSearchView.findViewById(searchPlateId);
if (searchPlateView != null) {
searchPlateView.setBackgroundColor(getResources().getColor(R.color.white));
}
}
The problem is that the moment I setIconified(false) on the serachview, the keyboard pops up, and I do not want this to happen. Is it possible to prevent this somehow? PS: I Have this in the manifest:
android:windowSoftInputMode="adjustNothing|stateHidden"
Also do it programmatically in onCreate but no luck
Try this:
searchView.setFocusable(false);
searchView.setIconified(false);
searchView.clearFocus();