Reputation: 16622
I'm trying to recreate an aspect of the Action Bar in Google Calendar - specifically I want to display a title ("May 2012" in the image) which when clicked provides a drop down menu, of which the title is not a part of.
Has anyone got a way of doing this - ideally I'm looking for something which will work in ActionBarSherlock, to provide backward compatibility.
Upvotes: 1
Views: 232
Reputation: 3729
Was trying to achieve the exact same result today and of course the best is to look at Google's very own Calendar Sources here (thanks Nicolas Klein).
The code you want to look at is used in AllInOneActivity, which uses a custom Adapter (CalendarViewAdapter extends BaseAdapater) and two different layouts (actionbar_pulldown_menu_button.xml and actionbar_pulldown_menu_top_button.xml)
They basically inflate the menu layout in the getDropDownView method of the adapter and the top menu layout in the getView method.
Upvotes: 4