I have 3 activities in my project and I would like to remove/hide the searchView in the actionbar on only one activity.
I tried searchView.setVisibility(View.GONE); but there is still the clickable icon.
main_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/menu_search"
android:title="@string/menu_search"
android:icon="@drawable/ic_menu_search"
android:showAsAction="ifRoom|collapseActionView"
android:actionViewClass="android.widget.SearchView" />
<item
android:id="@+id/item_clear_memory_cache"
android:title="@string/menu_item_clear_memory_cache"/>
<item
android:id="@+id/item_clear_disc_cache"
android:title="@string/menu_item_clear_disc_cache"/>
</menu>
menu.findItem(R.id.menu_search).setVisible(false);should be the way.