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,

user1164429
  • 241
  • 5
  • 16
  • 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 LinearLayout – tainy Oct 10 '16 at 03:03

1 Answers1

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" />
GrIsHu
  • 29,068
  • 10
  • 64
  • 102