i am trying to give animation to ExpandableListView
. i did manage to give animation to expanding list when group is click with following 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);
}
How can I achieve when child-collapsed, I saw sum tutorial Android Animation: Hide/Show Menu but did not succeed. Can anyone tell how to make it?
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.
I tried select position but didn't work.
Edit :- i also saw this http://upadhyayjiteshandroid.blogspot.in/2013/03/android-exapandlistview-animation.html but i want list to be display when click on group
Edit2 : i have added this code , but in this only last child is animated
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;
}
});