Dialog
を表示および非表示にするカスタムアニメーションを適用しようとしています。アニメーションを使用しているときにダイアログビューが「手動で」アニメーション化されますが、アニメーションを使用しないときには
View
は、「手動」アニメーションと呼ばれる.animate()
と、Animation
オブジェクトを受け取る.startAnimation(Animation animation)
という2つのアニメーション方法を提供します。
alertDialog.getWindow().getDecorView()
を呼び出してダイアログのビューにアクセスし、startAnimation
を使用してアニメートしようとしましたが、動作しません。 animate
関数を使用した場合にのみ、私はそれをアニメートできます。ここで
は、私の知る限りでは、同じ結果を返す必要があり、そのコード例ですが、私が扱ってる問題を再現:
AlertDialog dialog = AlertDialog.Builder(MainActivity.this).create(); // Create the dialog
View decorView = dialog.getWindow().getDecorView(); // Access the dialog's view
// The animation below works fine
decorView.animate().rotationXBy(45).setDuration(500).start(); // Animate it "manually"
// Create an animation instance
RotateAnimation scaling = new RotateAnimation(0, 45);
scaling.setDuration(500);
scaling.setFillAfter(true);
// This animation does NOT work
decorView.startAnimation(scaling);
私は他のビューと同じコードを試してみましたが、それ正常に動作するので、機能を破壊するダイアログにはいくつかの特質があると思いますか?
私は何か間違っているかどうか知りたいです、可能であれば、私が望むものをどのように達成することができますか?