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

前端 未结 3 974
猫巷女王i
猫巷女王i 2020-12-09 05:31

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 usin

3条回答
  •  醉话见心
    2020-12-09 05:42

    An alternative to your requirement could be ,that you create a list view,, position it under your button & set it's visibility to invisible by default & when you click on the button you can toggle the listview's visibility .... for example

    button.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    if (LISTVIEW.isShown()) {
                        LISTVIEW.setVisibility(View.INVISIBLE);
                    } else {
                        LISTVIEW.setVisibility(View.VISIBLE);
                    }
    

    let me know if this helps...

提交回复
热议问题