Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : change the position of alert dialog icon

I have an alert dialog in android xml file.my alert dialog has an icon in the left side of it.I want to change the position of the icon to the right side. I dont want to use custum dialog too

like this :

enter image description here

like image 531
Mehdi khosravi Avatar asked Dec 16 '14 13:12

Mehdi khosravi


People also ask

How do you change dialog position in flutter?

You can Use Align widget and align your dialog widget as per your need. Here in example i am setting it to the bottomCenter that is Alignment(0, 1) . Example code: Align( alignment: Alignment(0, 1), child: Material( shape: RoundedRectangleBorder(borderRadius: BorderRadius.

How can I make alert dialog fill 100% of screen size?

If your dialog is made out of a vertical LinearLayout, just add a "height filling" dummy view, that will occupy the entire height of the screen. Nice!


1 Answers

For setting layout direction of alert dialog to RTL you can use OnShowListener method. after setting title , message , .... use this method.

 dialog = alertdialogbuilder.create();

        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dlg) {

          dialog.getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); // set title and message direction to RTL
            }
        });
        dialog.show();
like image 73
Hamid Avatar answered Oct 04 '22 00:10

Hamid