title: ExpandableListView Animation while closing expanded list
body: <p>i am trying to give animation to <code>ExpandableListView</code>. i did manage to give animation to expanding list when group is click with following code </p>
  
  <pre><code>               public View getChildView(final int groupPosition,
              final int childPosition, boolean isLastChild, View convertView,
              ViewGroup parent) {
  
          if (convertView == null) {
              vv = (RelativeLayout) getLayoutInflater().inflate(
                      R.layout.homescreen_submenu, null);
          } else {
              vv = (RelativeLayout) convertView;
          }
  
          animation = AnimationUtils.loadAnimation(getApplicationContext(),
                  R.anim.anim_pushin);
          vv.startAnimation(animation);
          }
  </code></pre>
  
  <p>How can I achieve when child-collapsed, I saw sum tutorial <a href="https://stackoverflow.com/questions/7070225/android-animation-hide-show-menu">Android Animation: Hide/Show Menu</a> but did not succeed. Can anyone tell how to make it?</p>
  
  <p>and 
  2) When I am scrolling while group is expanded and then if I click on 2nd group, 2 group header goes out of the screen, I can see sub menu of that.</p>
  
  <p>I tried select position but didn't work.</p>
  
  <p>Edit :- i also saw this <a href="http://upadhyayjiteshandroid.blogspot.in/2013/03/android-exapandlistview-animation.html" rel="nofollow noreferrer">http://upadhyayjiteshandroid.blogspot.in/2013/03/android-exapandlistview-animation.html</a> but i want list to be display when click on group </p>
  
  <p>Edit2 : i have added this code , but in this only last child is animated </p>
  
  <pre><code>    mainmenu.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
  
          public boolean onGroupClick(final ExpandableListView parent,
                  View v, final int groupPosition, long id) {
              if (groupPosition == 2) {
                  Toast.makeText(Homescreen.this, "Group 2 clicked",
                          Toast.LENGTH_LONG).show();
                  return true;
              }
              if (groupPosition == 3) {
                  Intent nextscreen = new Intent(getApplicationContext(),
                          reminder.class);
                  startActivity(nextscreen);
                  finish();
                  return true;
              }
  
              if (groupPosition == 5) {
                  Toast.makeText(Homescreen.this, "Group 3 clicked",
                          Toast.LENGTH_LONG).show();
                  return true;
              } else
  
              if (mainmenu.isGroupExpanded(groupPosition)) {
  
                  vv.startAnimation(animationc);
                  animationc.setAnimationListener(new AnimationListener() {
  
                      @Override
                      public void onAnimationStart(Animation animation) {
                          // TODO Auto-generated method stub
                          vv.setBackgroundColor(getResources().getColor(
                                  R.color.white_trs));
                      }
  
                      @Override
                      public void onAnimationRepeat(Animation animation) {
                          // TODO Auto-generated method stub
  
                      }
  
                      @Override
                      public void onAnimationEnd(Animation arg0) {
                          // TODO Auto-generated method stub
                          mainmenu.collapseGroup(groupPosition);
  
                      }
                  });
  
                  return true;
              }
              return false;
          }
      });
  </code></pre>