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

标签 android animation

我有一个使用 Alertdialog 的 android 应用程序。我正在为此对话框设置动画。我想从左上角开始动画并在右下角结束。即,对话框想要从左上角移动到右下角在动画持续时间内。

我怎样才能做到这一点?

最佳答案

试试这个

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

关于android - 如何更改警报对话框的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12563687/

相关文章:

r - gganimate 在 windows 10 中呈现像素化

Android:如何在后台启动一个 Activity ?

android - 自定义动画不适用于 SingleInstance Activity

java - 将多个 Hashmap 合而为一。 java

javascript - react native 动画延迟不尊重给定值

ios - 如何在 iOS swift 运行时更新 CAGradientLayer 颜色?

wpf - 完全通过代码 WPF 执行翻转动画

html - CSS 动画移动位置与变换

android - Google map 标记图标在 Xamarin Android 中变得模糊

java - 在android中动态添加按钮和布局