How to make SearchView always expanded in android?

You can use the property android:iconifiedByDefault="false" on XML or set programatically setIconifiedByDefault(false). Acording to the documentation this property set the SearchView expanded like you want.

Take a look at SearchView.setIconifiedByDefault(boolean iconified)


SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
searchItem.expandActionView();

and in menu file, use

 showAsAction="ifRoom|collapseActionView"

If any query, feel free to comment.