Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Actionbar PopupMenu with Custom Item Layouts

I am working on an Android application where I have to design a menu which will populate from the action bar, like this:
enter image description here

I have tried my best but was not able to produce it using the Android controls.

The solutions I have tried are:

  1. With Actionbar, add a menu item with a group with selectable="all", that produces the layout I need but when I click a checkbox for selecting it, the whole menu hides and selection is not done, moreover the menu icon in actionbar does not have the bottom right white arrow.

  2. Tried creating a custom ActionProvider and added the menu items using class's OnPrepareSubMenu method but had the same issue.

I just need a push in the right direction and I can do the rest, suggestions are more than welcome.

Thank you :)

like image 697
TilalHusain Avatar asked Nov 11 '22 17:11

TilalHusain


1 Answers

Use popupWindow.
In that you can make any custom layout and set it as content of your popupwindow and also you can specify an ANCHOR in your case it would be
R.id.your_menu_item
set a listener and listen the changes.

like image 81
johntheripp3r Avatar answered Nov 15 '22 06:11

johntheripp3r