开发者

Android Animation for all the items in a list

i have a listView which uses a custom .xml for showing each item.

Fine, in this xml i have a CheckBox (with visibility set GONE) and a TextView with a text.

What i want is have an animation which moves the t开发者_如何学Goext to the right and shows the CheckBox.

I have the animation working fine for one item, but if i want to start it for all the items the problem comes.

I've tried with a loop over all the items but the animations start at different times (so visually is weird). Also, i've tried with an AnimationSet, but it moves the entire listview to the right instead the TextView (i can't launch the animationset from a single item because only moves that item then).

So.. anyone could help me?

Thanks


Use two Animation objects, one for the CheckBox, one for the TextView. Configure each Animation, and call startAnimation() on each widget. The animations will run in parallel.


I am new to Android development but it sounds like you might want to look into writing a custom class that inherits from LayoutAnimationController. In this subclass you would override the getDelayForView(android.view.View) method. This way you could set the delay time to nothing and the specified animation should run on all of the items at the same time.

Like I said I am new to this Android party so I could be completely off, but from the way I understand it this sounds like the way to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜