Supragyan Mandal
Supragyan Mandal

Reputation: 15

How the slide down animation will work the reverse

I am working on android animation slide down its working fine but i need that should work just the reverse, means it should open from bottom to top currently its opening from top to bottom.

My Code is:

<scale
    android:duration="900"
    android:fromXScale="1.0"
    android:fromYScale="0.0"
    android:interpolator="@android:anim/linear_interpolator"
    android:toXScale="1.0"
    android:toYScale="1.0" />

Upvotes: 0

Views: 132

Answers (1)

ranjitzade
ranjitzade

Reputation: 551

Suppose you are navigating from activity One to activity Two. Just add this code to your animation file in anim folder

slide_up_from_bottom.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
    android:duration="300"
    android:fromYDelta="100%p"
    android:toYDelta="0" />

Then you need to make a blank animation

no_animation.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
    android:duration="300"
    android:fromYDelta="0%p"
    android:toYDelta="0%p" />
</set>

then add below line to your Activity Two onCreate method before setContentView(layoutId)

        overridePendingTransition(R.anim.slide_up_from_bottom, R.anim.no_animation);

Hope this helps.

Upvotes: 1

Related Questions