Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 491
Ilya Demidov Avatar asked Jun 30 '12 12:06

Ilya Demidov


1 Answers

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.

like image 155
XGouchet Avatar answered Nov 09 '22 04:11

XGouchet