The best way to create drop down menu in android 2.x like in ICS

Ilya Demidov picture Ilya Demidov · Jun 30, 2012 · Viewed 9k times · Source

I want to create button with drop down menu, like overflow menu button in ActionBar on ICS. I have problem because PopupMenu there isn't in android 2.x. The second way using Spinner but it's not for me, because Spinner always show the first item on my custom background or my selected item. How can I acheive it? In general, I want ContextMenu but little and on position clicked view. Thanks.

It looks like this : Overflow menu in right top corner

Answer

XGouchet picture XGouchet · Jul 4, 2012

If your purpose is to recreate an action bar, you could take a look at the ActionBarSherlock project, which backports thoses functionalities.

If you want to be able to pop such a menu anywhere in your app, you could read the implementation of the MenuPopupHelper class implementation in the ActionBarSherlock project source code.