user3555472
user3555472

Reputation: 836

Android Slide down to up and up to down

I am working on Dialog and I want to animate it from down to up and up to down. I tried with this code: bottom_up.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
    android:duration="500"
    android:fillAfter="true"
    android:fromYDelta="125%p"
    android:toYDelta="0%p" />
</set>

bottom_down.xml

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

<translate
    android:duration="500"
    android:fillAfter="true"
    android:fromYDelta="0%p"
    android:interpolator="@android:anim/linear_interpolator"
    android:toYDelta="100%p" />

</set>

Above code animate dialog to center of screen. But I need that slide up from bottom but align with bottom. and slide down.

How can I do it?

Upvotes: 1

Views: 418

Answers (1)

Chaudhary Amar
Chaudhary Amar

Reputation: 856

Try This For Slide Down:

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

And just reverse of it for Slide Up.

Upvotes: 1

Related Questions