Android : Get view Reference to a Menu Item

You can achieve this by providing your menu item with an actionViewClass property in xml and then you will be able to get the pivot view u wanted. The code would be something like this <item android:id=”@+id/menu_find” android:showAsAction=”ifRoom” android:actionViewClass=”android.widget.ImageButton” /> In your OnCreateOptionsMenu do this public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_search, menu); locButton = … Read more