0
Ich möchte auf eine Schaltfläche klicken, und eine Schaltfläche wird in Dialog umgewandelt, wie das Bild. Ich habe keine Ahnung, wie ich das machen soll. pictureDialog mit Animation
Ich möchte auf eine Schaltfläche klicken, und eine Schaltfläche wird in Dialog umgewandelt, wie das Bild. Ich habe keine Ahnung, wie ich das machen soll. pictureDialog mit Animation
ich verwendet, um die folgende Animation, so etwas zu erreichen .. 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>
Sie können pivotX und pivotY nach Ihrem Bedarf ändern. 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>
in Ihrem Dialog Schreib
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme;
hoffe, das hilft!
starten Sie hier: https://developer.android.com/training/transitions/overview.html –