Sunday, October 7, 2018

Android How to give slide up/down animation with Activity

 Define an animation in res/anim/slide_in_up.xml:


    android:fromYDelta="100%p" android:toYDelta="0%p"
    android:duration="@android:integer/config_longAnimTime"/>
and another at res/anim/slide_out_up.xml:


    android:fromYDelta="0%p" android:toYDelta="-100%p"
    android:duration="@android:integer/config_longAnimTime"/>
Then apply these after to call startActivity:

Intent i2 = new Intent(main.this, test.class);
startActivity(i2);
overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );

references:
https://blog.stylingandroid.com/simple-animation-part-1/

No comments:

Post a Comment