Andrew
Andrew

Reputation: 8090

Get an effect like google currents for a gridview

I've got an app with a list of items displayed in a gridview. I'd love to be able to create an animation effect like used in google current where as a new item comes onto the screen it slowly moves up into a place where it settles.

Currently I've been playing with android:layoutAnimation on the GridView element, but this doesn't seem to give the kind of control I'm wanting. Does anyone have any pointers on this as to what might need to be done?

Upvotes: 2

Views: 1966

Answers (1)

vork
vork

Reputation: 71

I'm working on the same Animation. Basically I created a custom Layout which extends LinearLayout and implements onGlobalLayoutListener. In onGlobalLayout() I loop through all childs and use .startAnimation on each child. For the Animation use something like this:

slide_up.xml

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

    <translate
        android:duration="800"
        android:fromYDelta="100%p"
        android:toYDelta="0" />

    <alpha
        android:duration="800"
        android:fromAlpha="0.0"
        android:toAlpha="1.0" />

    <rotate
        android:duration="800"
        android:fromDegrees="25"
        android:pivotX="0"
        android:pivotY="0"
        android:toDegrees="0" />

</set>

Edit: More Info on this here: http://shardulprabhu.blogspot.de/2012/09/google-now-cards-layout.html

Upvotes: 1

Related Questions