OverridePendingTransition duration is ignored

I use overridePendingTransition to set my own activity transition. Everything works fine, except that I cannot change the duration of the animation, it is ignored.

slide_down.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_decelerate_interpolator">

    <translate
        android:duration="2000"
        android:fromYDelta="0"
        android:toYDelta="100%p"
        android:zAdjustment="top"/>

</set>

stay.xml

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

The duration is set to 2000 ms, but the animation is still only a fraction of a second. Even changing it to an extreme value, such as 10000, does nothing.

If I change the animation in the settings of the developer in the settings, the duration of the animation corresponds to the specified settings.

Java code for reference:

MainActivity.java

public void games(View view){

    startActivity(new Intent(MainActivity.this, GamesActivity.class));
    overridePendingTransition(R.anim.slide_up, R.anim.stay);


}

Anyone who has an idea?

+4
source share
1

, , .

. . , Instant Run .

0

Source: https://habr.com/ru/post/1651880/


All Articles