views:

431

answers:

2

Hi, 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 text 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

+1  A: 

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.

CommonsWare
thanks for the reply, but what i want is the animations run in parallel over the entire list.For example, when i press a button, all the rows run the animation at the same time
xger86x
OK, use 2xN `Animation` objects, one for each `CheckBox` in each visible row, one for each `TextView` in each visible row. I don't know how well this will perform, though.
CommonsWare
i think i didn't explain the problem well.The problem is that i don't know when call startAnimation() because if i call it inside the loop which go over the elements and creating the animation for the row, the animation for each row doesn't run at the same time.And if a set an AnimationSet, it only works for a row, not the entire list.Thanks again
xger86x
Code a tighter loop. Otherwise, what you want probably is not possible.
CommonsWare
i found the way... i don't need a animation. If i make visible the check buttons is enough...Some times the simplest solution is better..Thanks anyway
xger86x
A: 

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.

zznq