etilia etilia - 4 months ago 25
Android Question

Android AlertDialog button positioning

I have a requirement to create an

AlertDialog
, which is split vertically into two zones:


  1. One of these zones (on the right side) should have dialog buttons (OK, Cancel and Set) at the bottom and another layout on top of these buttons.

  2. Left side of this dialog should have another layout, say, image.



The question is, is it possible to have anything like that or all alertDialogs have to have all their buttons at the bottom? I don't even know where to start. I've tried looking at
AlertDialog
class, but could see anything suitable.

Answer

it looks like you don't need an AlertDialog for this, but yes you can do it with AlertDialog. create your view and then use AlertDialog.Builder without calling setPositiveButton(), setNegativeButton() etc..

AlertDialog alertDialog = new AlertDialog.Builder(context)
        .setView(yourContentView)
        .create();
Comments