-1
Любой учебник для ExpandableListview Для андроида с анимацией Fold? Я использую этот адаптер, но это не гладкая я не знаю, почему, какие-либо предложения для гладкого адаптера и как я могу включать Fold анимацию в то время как коллапс и расширитьAndroid ExpandableListview
Мой адаптер:
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 the Animation properties
anim.setRepeatCount(0);
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(1200);
anim.setFillAfter(true);
// Step 3: Start animating the 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 the Animation properties
anim.setRepeatCount(0);
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(1200);
anim.setFillAfter(true);
// Step 3: Start animating the 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);
}
}