3

I am trying to apply some kind of an animation for the ExpandableListView. I have done some research and looks like its a right pain. I managed to apply slide animation on the expand, however i cant work out how to apply anything on collapse.

I used

How to write custom ExpandableListAdapter

for my ExpandableListView. As it stands at the moment i apply this t oa child convertView and it works fine on expand, but i cant figure out how it collapses.

 Animation fadeAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_in);
 convertView.startAnimation(fadeAnimation );

Would anyone be able to help or perhaps there is a better solution for this?

Community
  • 1
  • 1
Nabdreas
  • 3,327
  • 4
  • 27
  • 30

2 Answers2

2

I wrote a nice implementation that extends an ExpandableListView here: https://github.com/idunnololz/AnimatedExpandableListView/

It uses the idea I explained here Android ExpandableListView using animation to do the animations.

Community
  • 1
  • 1
idunnololz
  • 8,058
  • 5
  • 30
  • 46
0

i do something similar with my ExpandableListView. I use custom child layouts inflated from xml. But this should not matter.
You should override the onChildClick onGroupClick and maybe other listeners. In this listeners you can animate your stuff.
And you can try to use animateLayoutChanges what was not working fine for me.

A. Binzxxxxxx
  • 2,812
  • 1
  • 21
  • 33