Alertdialog setItems with custom layout

When I use setItems with a custom layout, my layout appears below the item buttons (generated by setItems).

Is there a way to show custom layout on top and then item buttons? Or do I need to add item buttons to my own layout?

    AlertDialog.Builder myDialog = new AlertDialog.Builder(this);
    LayoutInflater inflater = getLayoutInflater();
    View layout = inflater.inflate(R.layout.alert_dialog_addons, null);
    myDialog.setTitle(title);

    myDialog.setView(layout); // WANT TO SHOW THIS ON TOP

    //THEN THIS
    myDialog.setItems(options, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            //DO SOMTHING
        }
    });
    myDialog.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    myDialog.create().show();

      

+3
android android-alertdialog alertdialog


source to share


No one has answered this question yet

Check out similar questions:

1002
Grid motion detection
3
Create and display an AlertDialog from a custom ListAdapter
2
setText on a button from another kind of android activity
1
AlertDialog error ... sometimes
1
How to delete an item in ListView and database - Android Studio
0
How to create a custom dialog "Button Area"
0
How to close Android dialog that is a native XML file
0
AlertDialog Layout under buttons
-2
Alert Dialog Builder will not show ArrayList
-2
when the mesg box comes out it goes back to prevoius activyty



All Articles
Loading...
X
Show
Funny
Dev
Pics