Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change position of Alert Dialog

I have an android application uses Alertdialog.I am setting animation for this dialog.I want to start the animation from top left and ends at bottom right.ie,The dialog want to moves from top-left to bottom-right with in the animation duration time.

How can i achieve this?

like image 515
Asha Soman Avatar asked Jan 16 '23 12:01

Asha Soman


1 Answers

try this

AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("Final Result");
        alert.setMessage(msg);
        alert.setPositiveButton("OK",
                new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub

                    }

                });


        // dlgAlert.create();
        AlertDialog dialog_card = alert.create();
        // dlgAlert.requestWindowFeature(Window.FEATURE_NO_TITLE);
        // WindowManager.LayoutParams WMLP =
        dialog_card.getWindow().setGravity(Gravity.TOP);

        dialog_card.show();`
like image 151
sumit acharya Avatar answered Jan 27 '23 20:01

sumit acharya