Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Expandable listView expand with animation?

I'm trying to animate the way the expandable listView expands, but I can't find anything on the web on how to do that except for this: https://github.com/idunnololz/AnimatedExpandableListView/ and I'm not that professional so I can't understand how to implement it to my activity. Please if you know tell me how to add it my activity or another way to do so, thanks

like image 617
youssef abaza Avatar asked Nov 09 '22 21:11

youssef abaza


1 Answers

Apply animation on OnGroupClickListener. You could do something like -

listView.setOnGroupClickListener(new OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            if (listView.isGroupExpanded(groupPosition)) 
                listView.collapseGroupWithAnimation(groupPosition);
            else 
                listView.expandGroupWithAnimation(groupPosition);
            return true;
        }

    });

Link to AnimatedExpandableListView library.

like image 124
mihirjoshi Avatar answered Nov 14 '22 23:11

mihirjoshi