2

I want to animate slide up slide down animation on expandable list view. when I click the group Item, It will expand the child view and collapse it.In the get Child view method I am populating the child views.

The following code to populate child views.

public View getChildView(int groupPosition, int childPosition, 
        boolean isLastChild, View convertView, ViewGroup parent) { 
    Log.i(TAG, "getChildView"); 
    if (convertView == null) { 
            LayoutInflater layoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
            convertView = layoutInflater.inflate(R.layout.child, null); 
    } 
    View toolbar = convertView.findViewById(R.id.toolbar); 
    setAnimationView(toolbar); 
    ((LinearLayout.LayoutParams) 
toolbar.getLayoutParams()).bottomMargin = -75; 
    toolbar.setVisibility(View.GONE); 
    ExpandAnimation expandAni = new ExpandAnimation(toolbar, 1000); 
    toolbar.startAnimation(expandAni); 
    TextView tv = (TextView) convertView.findViewById(R.id.childTo); 
    tv.setText(text); 
    return convertView; 
} 

How can I solve my problem.please help... Thanks & Regards, Venkatesan.R

  • Hey, did you find any solution to the problem ? – Swayam Dec 11 '13 at 13:22
  • Hi Swayam, I am working on Calendar with gridview ,Rightnow I have implemented gesture listener for left and right swipe,All are working fine , But using onsingletapconfirmed i could not able to get the position of the selected item in the griview. It remains position 0 on all selected item in the Gridview.I tried with the below code int j = gridview.pointToPosition((int)event.getX(), (int)event.getY()); Please help to me solve the problem. – Venkatesan Ramdoss Dec 23 '13 at 17:37
  • Actually even I was looking for a similar animation and ended up using https://github.com/tjerkw/Android-SlideExpandableListView/. I am not sure how to get the position of the click though. – Swayam Dec 24 '13 at 05:52
  • @VenkatesanRamdoss can you please explain what is the problem? do you want to add animations for the child-views when you expand the groups? – android developer Jan 02 '14 at 13:28
  • Thanks for your kind reply.Currently I am displaying current week in the gridview,When a user swipe down it will display the whole month.My requirement is I need to do animation for slide down and slide up.When a user swipe down i need to apply the slide down animation with the whole month.Please help. – Venkatesan Ramdoss Jan 18 '14 at 09:28

2 Answers2

1

I recently just wrote an widget for doing exactly what you've asked for. I've released the source code here: Android ExpandableListView using animation

I may improve the implementation and add comments in the future, but the main idea will stay the same. Take a look at this post if you are interested in how it works: Android ExpandableListView using animation.

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

the ListView classes are made for performance for a great number of rows with just in time drawing while sliding. so animation is no goal of this kind of view and not that easy.
maybe something like android:animateLayoutChanges="true" could work.
you can also take a look here: link

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