Custom action item ActionBarSherlock
actionbarsherlock, android, android-actionbar
Solution
Sure, from XML you can set an arbitrary layout as the action view:
<item android:id="@+id/menu_refresh_progress"
android:actionLayout="@layout/menu_progress"
android:showAsAction="always"/>
But since presumably you want to update the badge to something current, you can also set an arbitrary view if you're creating the menu by hand in `onCreateOptionsMenu()`:
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
MenuItem someMenuItem = menu.getItem(R.id.menu_option_id);
someMenuItem.setActionView(theView);
return true;
}
Problem
I'm trying to add some custom actions into my `ActionBar`, Is it possible to implement these actions with a custom layout? Because I want to add some badge like notification counter to these actions. e.g Any idea to how accomplish this?