listview - Android ExpandableListview -
any tutorial expandablelistview android fold animation ? m using adapter it's not smooth don't know why , suggestions smooth adapter , how can include fold animation while collapse , expand
my adapter :
public class customlistadapter extends baseexpandablelistadapter { list<categoriesobject> categoriesobjectlist; context context; imageview rightimage; imageview iconimage; public layoutinflater inflater; public servicehelper servicehandler; imageloader imgloader; public customlistadapter(activity context, list<categoriesobject> categoriesobjectlist) { // super(context, r.layout.list_content_row); // todo auto-generated constructor stub this.categoriesobjectlist = categoriesobjectlist; this.context = context; inflater = context.getlayoutinflater(); imgloader = new imageloader(context); } @override public serviceobject getchild(int groupposition, int childposition) { list<serviceobject> chlist = categoriesobjectlist.get(groupposition).services; return chlist.get(childposition); } @override public long getchildid(int groupposition, int childposition) { return childposition; } @override public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent) { serviceobject child = (serviceobject) getchild(groupposition, childposition); if (convertview == null) { layoutinflater infalinflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); convertview = infalinflater.inflate(r.layout.servicelist_content_row, null); } servicesmanager.setcontext(this.context); if(servicesmanager.serviceisselected(child)) { convertview.findviewbyid(r.id.menutitle).setbackgroundcolor(color.parsecolor("#cc0fcb9e")); rotateanimation anim = new rotateanimation(0f,45f, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); // step 2: set animation properties anim.setrepeatcount(0); anim.setinterpolator(new linearinterpolator()); anim.setduration(1200); anim.setfillafter(true); // step 3: start animating image imageview leftimage = (imageview)convertview.findviewbyid(r.id.leftimage); leftimage.startanimation(anim); } else { convertview.findviewbyid(r.id.menutitle).setbackgroundcolor(color.parsecolor("#cc0fcb9e")); rotateanimation anim = new rotateanimation(45f, 0f, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); // step 2: set animation properties anim.setrepeatcount(0); anim.setinterpolator(new linearinterpolator()); anim.setduration(1200); anim.setfillafter(true); // step 3: start animating image imageview leftimage = (imageview)convertview.findviewbyid(r.id.leftimage); leftimage.startanimation(anim); convertview.findviewbyid(r.id.menutitle).setbackgroundcolor(color.parsecolor("#cc2e5c78")); } final textview tv = (textview) convertview.findviewbyid(r.id.title); textview price = (textview) convertview.findviewbyid(r.id.pricetxt); tv.settext(child.servicename.tostring()); price.settext(string.valueof(child.serviceprice)); return convertview; } @override public int getchildrencount(int groupposition) { list<serviceobject> chlist = categoriesobjectlist.get(groupposition).services; return chlist.size(); } @override public categoriesobject getgroup(int groupposition) { return categoriesobjectlist.get(groupposition); } @override public int getgroupcount() { return categoriesobjectlist.size(); } @override public long getgroupid(int groupposition) { return groupposition; } @override public view getgroupview(int groupposition, boolean isexpanded, view convertview, viewgroup parent) { categoriesobject group = (categoriesobject) getgroup(groupposition); if (convertview == null) { layoutinflater inf = (layoutinflater) context .getsystemservice(context.layout_inflater_service); convertview = inf.inflate(r.layout.list_content_row, null); } textview tv = (textview) convertview.findviewbyid(r.id.title); imageview iconimage = (imageview)convertview.findviewbyid(r.id.iconimage); imgloader.displayimage(group.catimage,iconimage); // new imageloadtask(group.catimage, iconimage).execute(); tv.settext(group.catname); return convertview; } @override public boolean hasstableids() { return true; } @override public boolean ischildselectable(int groupposition, int childposition) { return true; } private static class childholder { textview title; textview hint; } public interface servicehelper { public void serviceclicked(int grouppos, int childpos); }
}
check out: animated expandable listview
Comments
Post a Comment