views:

45

answers:

1

I want the items in the listview to slide in one at a time from left to right. I have the following in res/anim/slide_right.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:fromXDelta="100%p" android:toXDelta="0" android:duration="150" />
</set>

And in my onCreate method in my ListActivity I have:

LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, R.anim.slide_right);
mList.setLayoutAnimation(controller);

When I run it, I get a RuntimeException caused by "Unknown layout animation name: set"

What am I doing wrong?

+1  A: 

I am not sure if you have already found the soulution but let me tell you the way I found the solution.

Make another Android xml in ur anim folder. Let it be list_layout_controller.xml as below

Now, set list_layout_controller.xml as the animation as below and run:

LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, R.anim.list_layout_controller.xml); mList.setLayoutAnimation(controller);