Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Odd ActionBar Behavior for ICS and setActionView #425
On ICS if you have a couple menu items showing in the ActionBar ( android:showAsAction="ifRoom") and you want to set one to an animation or different icon using "MenuItem.setActionView()" when pressed. The menu item next to the changed the pressed item immediately shows a blue highlight as if selected. It's like the pressed one loses the up highlight but it's transfered to the menu item next to it instead.
Here is what the actionbar_indeterminate_progress.xml looks like:
Here is your mainmenu.xml:
This is the native action bar so anything you see is beyond this library.
The action bar re-uses action item views in an effort to speed up invalidation. When you change a view to use a custom layout it reuses the existing view for the next non-custom action item. Since it will still be in the fade state of its selector it will still appear blue. They should be calling
Yep, if you set your own custom selector for the action item background you can remove the fade which fixes the issue. I grabbed the abs__item_background_holo_dark.xml from ActionBarSherlock > Library > res > drawable and the associated graphics to add to my project. I removed the following line from the nod in the xml which disables the fade:
Here is abs__item_background_holo_dark.xml:
Here is how I set it up in my styles.xml