如何更改警报对话框的位置

Ash*_*man 3 animation android

我有一个Android应用程序使用Alertdialog.I我正在为这个对话框设置动画.我想从左上角开始动画并在右下角结束.我想,对话框想要在动画中从左上角移动到右下角持续时间.

我怎样才能实现这一目标?

sum*_*rya 6

试试这个

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();`
Run Code Online (Sandbox Code Playgroud)