0
ボタンをクリックしたいと思います。ボタンが画像のようにダイアログに変わります。私はこれをどうやって行うのか分かりません。 pictureアニメーションのあるダイアログ
ボタンをクリックしたいと思います。ボタンが画像のようにダイアログに変わります。私はこれをどうやって行うのか分かりません。 pictureアニメーションのあるダイアログ
私はそのような何かを達成するために、次のアニメーションを使用.. slide_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fromXScale="0.6"
android:fromYScale="0.5"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
<translate
android:duration="600"
android:fromYDelta="22%"
android:toYDelta="0%" />
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fillAfter="true"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
slide_down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.6"
android:toYScale="0.5" />
<translate
android:duration="600"
android:fromYDelta="0%"
android:toYDelta="26%" />
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:fillAfter="true"
android:fromAlpha="1.0"
android:toAlpha="0" />
</set>
あなたはあなたの必要性に応じてpivotXとpivotYを変更することができます。 style.xml
<style name="DialogTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">@color/transparent</item>
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
あなたのダイアログの書き込みで
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme;
・ホープ、このことができます!
ここから開始:https://developer.android.com/training/transitions/overview.html –