I have a LinearLayout
with layoutAnimation
property that is used for a customize ExpandableListView
. like this :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layoutAnimation="@drawable/list_layout_controller"
android:orientation="vertical" >
When I click on the list, the animation will be displayed. But it works only once and it will not animate the list in the next click. Why?
Please let me know, If you need more description.
Thank you
Layout Animations are run when views are added to the layout. So you will have to manually add/remove the views on every expand/collapse for the layout animation to work.
For this, you can maintain a Map of views with the list index as the key. Every time you get click, just pick the corresponding items from the map and add to your layout. The animation will run on that view and your problem is fixed.
You can also try by changing the visibility of views in onClick()
. But not sure about this.
Try and let me know.
Hope that helps.
First u want to declare
Animation listanimation = AnimationUtils.loadAnimation(mainActivity.this, R.anim.list_layout_controller);
and everytime clearAnimation
first.
In clickevent of LinearLayout
linearLayout.clearAnimation();
linearLayout.startAnimation(listanimation);
call
listView.scheduleLayoutAnimation();
before all changes in the list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With