setting different indicators for different groups in android
I would like to know how to set different indicators for different groups in ExpandableListView.
I tried :
if(true condition for a group say groupA)
{
getExpandableListView().setGroupIndicator(getResources().getDrawable(R.drawable.image));
}
but the above code sets the indicator for all the groups in the view ! I want different indicators for all the groups like :
groupA having a different indicator;groupB having a different indicator;groupC having a different indicator
where groupA,groupB and groupC have cert开发者_开发技巧ain number of children.
Can anyone suggest something ?
-Adithya.
To create different indicator in expandable listview. First of all create Adapter for expandable listView. Create custom layout for all different indicator.
Now in your getGroupView method
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
LayoutInflater infalInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (groupPosition == 0) {
convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
} else if (groupPosition == 1) {
convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
}else if (groupPosition == 2) {
convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
}
}
Try this this is work for me... Hope this is helpful for you..
精彩评论