特定的Android弹出菜单

时间:2013-02-12 14:12:08

标签: android menu popupmenu

我熟悉Android PopupMenu功能,但我想要一个如下所示的弹出窗口:enter image description here

1 个答案:

答案 0 :(得分:4)

简单来说,Android开发者网站(http://developer.android.com/index.html)已经通过教程详细解释了所有这些内容。试试这个:

AlertDialog.Builder builder = new AlertDialog.Builder(this);

builder.setTitle(title);

builder.setItems(new CharSequence[] {"Copy Text", "Delete", "Details"} , 
    new DialogInterface.OnClickListener() 
    {
        public void onClick(DialogInterface dialog, int which) { /* which is an index */ } 
    }); 
builder.show();