简体   繁体   English

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

[英]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. 我有一个Android应用程序使用Alertdialog.I我正在为这个对话框设置动画。我想从左上角开始动画并在右下角结束。我想,对话框想要在动画中从左上角移动到右下角持续时间。

How can i achieve this? 我怎样才能实现这一目标?

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();`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM