Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make popup menu like this using ActionBarSherlock

I am using ActionBarSherlock in my application and I want to implement popup menu like the below image, having a logo and respective text.

Please help me to achieve this, any help would be appreciable.

Thanks

enter image description here

like image 971
Salman Khan Avatar asked May 23 '13 08:05

Salman Khan


2 Answers

Here it is.This is actually done in the app which you posted screenshot for.I think you are familiar with ActionbarSherlok.The button for this dropdown menu will be on actionbar.

public boolean onCreateOptionsMenu(Menu menu) {
    // Used to put dark icons on light action bar


    SubMenu subMenu1 = menu.addSubMenu("");



    subMenu1.add("Item1").setIcon(R.drawable.icon).setOnMenuItemClickListener(
            new OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {





                    return false;
                }
            });

    MenuItem subMenu1Item = subMenu1.getItem();
    subMenu1Item.setIcon(R.drawable.abs__ic_menu_moreoverflow_holo_dark);
    subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS
            | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    return true;
}
like image 190
Basim Sherif Avatar answered Nov 19 '22 05:11

Basim Sherif


Added PopupMenu in ActionBarSherlock.

like image 36
Mihir Avatar answered Nov 19 '22 05:11

Mihir