endy
endy

Reputation: 3872

Custom views in actionbar

I have an action bar. One of the items in the actionbar is for notifications. I want to add a little icon in the top right of the actionbar item which represents how many notifications the user currently has.

I went ahead and made a custom layout for the action bar item. Went to go add it and to my surprise there is no way for me to add a custom view as a button on a Action bar.

I am using Actionbar-Sherlock for compatibility to older device.

This is what I am going for:

enter image description here

Upvotes: 4

Views: 1783

Answers (1)

Paul Burke
Paul Burke

Reputation: 25584

You're looking for ActionProvider. Here you can supply your own views and listeners.

Check out the ABS demo, https://github.com/JakeWharton/ActionBarSherlock/blob/master/actionbarsherlock-samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java

Upvotes: 7

Related Questions