I created an ExpandableListView
in android. I have some categories which have some more sub-categories. While other do not have sub-categories.
How can I remove the
First of all , remove the default icon of expandable listview
And than in your adapter of Expandable listview in getGroupView
method use following code for it
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.YOUR_LIST_GROUP_XML, null);
}
TextView header_tv = (TextView) convertView.findViewById(R.id.list_header_tv);
ImageView arrow_iv =(ImageView) convertView.findViewById(R.id.arrow_iv);
header_tv.setText(headerTitle);
Boolean check = false;
try {
YOUR_HAS_MAP_LIST.get(this._listDataHeader.get(groupPosition))
.get(0);
}
catch (Exception ex)
{
check = true;
ex.printStackTrace();
}
if(check)
{
arrow_iv.setVisibility(View.INVISIBLE);
}
if(isExpanded)
{
arrow_iv.setImageResource(R.drawable.UP_ARROW);
}
else
{
arrow_iv.setImageResource(R.drawable.DOWN_ARROW);
}
return convertView;
}