Closed vivekwarde closed 10 years ago
Hey @vivekwarde, your question is more related to the ExpandableListView than to the lib. For now, I can't give you a complete working code, but I can give you some directions to achieve what you want.
If you want the green headers to Expand/Collapse everything else between the next green header, you'll have just one group type. Even though you consider the black/dark gray views as headers. The other 3 types of views will be considered as children types so you can properly expand and collapse them. The hardest part will be the logic to determine which type you have for a determined group and child position. Here a snippet of code with some instructions:
public class SampleExpandableListAdapter extends BaseExpandableListAdapter {
@Override
public int getGroupCount() {
// Return here the # of green headers
return 0;
}
@Override
public int getChildrenCount(int groupPosition) {
// To this green header position, return here the sum of black, dark gray and light gray children
return 0;
}
@Override
public int getChildTypeCount() {
// return 3: black, dark gray and light gray
return 3;
}
@Override
public int getChildType(int groupPosition, int childPosition) {
// Here is one of the most important part. You'll have to apply your logic to determine which child type is for this position:
// 0 for black
// 1 for light gray
// 2 for dark gray
return 0;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
// Here you'll inflate your green header
return null;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
// Here you'll inflate your child. You'll probably call here getChildType() to proper inflate your view
return null;
}
@Override
public Object getGroup(int groupPosition) {
return null;
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return null;
}
@Override
public long getGroupId(int groupPosition) {
return 0;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
}
I have described my question completely here
http://stackoverflow.com/questions/24382007/implementing-the-headers-as-floatinggroupexpandablelistviewe
, please have look.
Thank you !