Thursday 15 July 2010

android - Using 'changing' LayoutTransition type in a ListVIew has no effect -


In Android, I am currently trying to create a list whose height changes when clicking an item, depending on the animated scenes beneath that item or with the height change below. I have had success with the 'list' of items within a linear line using the following code:
  layoutTransitionT = new layout transition (); T.enableTransitionType (LayoutTransition.CHANGING); MyLinearLayout.setLayoutTransition (t);   

However, when I try to apply this LayoutTransition to a ListView instead of a LinearLayout, then animate the height of the clicked item, but all the items given below immediately Jump to the new position. How do I get the rest of the ideas to animate the clicked item?

You can not do this easily (and there is a better way to do this). The status of the ListView rows is fixed and controlled by the adapterview.

I did a little research First, to fire the change animation, you can not delete your line normally (delete items from adapter). If you've set your item to visibility, it will fade up the raw animation and result in the change animation. But to make the change animation, you will need to request the layout (at the list view) at any time when you are changing the height of the row at the end of the animation, you can remove your item from the adapter and redo the listview. . Also, you can make all the rows of your list stable with your posts, so that all the review points can not be removed. I tried to do it this way, but there were complexities on different versions of the Android API.

Finally, it is possible to apply the animation to ListView using layout installations but it is complex and does not qualify from the implementation point. This is enough for simple cases, but not for more complex animation in ListView. To implement the animation, it is better to use an already cooked component:

No comments:

Post a Comment