I am using the appcompat library with a toolbar and I have implemented a search view in my application. But I want to remove the search icon when it is expanded.
here is my xml file menu:
<item android:id="@+id/action_search" android:icon="@drawable/ic_search" android:title="@string/action_search" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="ifRoom|collapseActionView"/>
and this is how I inflate the menu:
getMenuInflater().inflate(R.menu.main, menu); SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); searchView.setQueryHint(getString(R.string.search_hint)); return super.onCreateOptionsMenu(menu);
this is what i want to remove:

android android-actionbar searchview appcompat android-actionbar-compat
user1785900
source share