Frage

My current android application has a requirement to have the "Next" screen slide up from the bottom of the screen as the current view slides out from the top. I can achieve this effect with anim and overridePendingTransition. However i want the "Next" screen to slide up faster from the bottom than than the current screen is sliding out the top of the screen. What attributes (and values) do i require in my animation xml files to achieve this effect?

War es hilfreich?

Lösung

This will slide the next screen in from the bottom to the top and the current screen out from the top and 25% up making the next screen slide over the current screen.

slide_in_bottom.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_mediumAnimTime"
    android:fromYDelta="100%p"
    android:toYDelta="0" />

slide_out_top.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_mediumAnimTime"
    android:fromYDelta="0"
    android:toYDelta="-25%p" />

Andere Tipps

slide_in_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="100%p" android:toXDelta="0%p"
    android:duration="@android:integer/config_shortAnimTime"/>

slide_out_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0" android:toXDelta="-100%p"
    android:duration="@android:integer/config_shortAnimTime" />


overridePendingTransition(R.anim.slide_in_left,
                        R.anim.slide_out_left);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top