解决方法
1)隐藏组指示符:
android:groupIndicator="@android:color/transparent"
2)为您想要为空的组返回一个空的FrameLayout,如下所示:
@Override public View getGroupView(int groupPosition,boolean isExpanded,View convertView,ViewGroup parent) { //By default the group is hidden View view = new FrameLayout(context); String groupTitle = getGroup(groupPosition).toString(); //in case there's more than one group and the group title is not empty then show a TextView within the group bar if(getGroupCount() > 1 && !groupTitle.isEmpty()) { view = getGenericView(); ((TextView)view).setText(groupTitle); } return view; }
3)呼叫expandGroup为不显示组组的组:
expandableListView.expandGroup(GROUP_ID);
4)如果要显示组指示符,则必须通过getGroupView方法以编程方式添加ImageView.查看这篇博文,了解隐藏/显示组指标的更多信息:Hiding group indicator for empty groups
原文地址:https://www.jb51.cc/android/310719.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。