How to animate a View to hide underneath another view, and then animate from that View
Asked Answered
P

1

6

I have two grid views that I would like to create a custom animation for. Imagine this layout:

___________________________________________
|                                         |
|                                         |
|               TOP Grid                  |
|                                         |
|_________________________________________|
|                                         |
|                                         |
|                 BOTTOM                  |
|                 Grid                    |
|                                         |
|_________________________________________|

The bottom grid will 'slide out' and 'slide' behind the top grid. I figure I should be using a translate animation. How do I find out the fromX & fromY values? I thought I could have both View in a Layout, and then set the animation as RelativeToParent.

It this the right approach? If you know of anywhere I can find source code for this functionality I would greatly appreciate it. Thank you,

Pangolin answered 19/3, 2012 at 17:13 Comment(1)
do you have any solution to do this? I also try to find out. Currently the Bottom grid will cover top grid when animation. And they are in LinearLayoutDoyledoyley
S
0

Try out this slide-out & slide-in Animations.

slide-top-in.xml

 <set xmlns:android="http://schemas.android.com/apk/res/android">
   <translate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator"
    android:fromYDelta="0" 
    android:toYDelta="-100%p" 
    android:duration="1000" 
               />
  </set>

slide-top-out.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator"
    android:fromYDelta="-100%p"
    android:toYDelta="0"
    android:duration="1000" />
Strop answered 1/1, 2013 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.