Android 可扩展列表指示器

Android 可扩展列表指示器,android,Android,我有一个可扩展的列表 所以有两个问题 (我见过一些类似的问题 但从未找到答案)我该怎么做 隐藏箭头(组指示器) 当没有孩子的时候 我试着在适配器中执行此操作 public View getGroupView(int groupPosition, boolean isExpanded, View convertView,ViewGroup parent) { if(getChildrenCount(groupPosition)==0) { // how do i hide the gr

我有一个可扩展的列表

所以有两个问题

  • (我见过一些类似的问题 但从未找到答案)我该怎么做 隐藏箭头(组指示器) 当没有孩子的时候

    我试着在适配器中执行此操作

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,ViewGroup parent) {
    if(getChildrenCount(groupPosition)==0) {
          // how do i hide the group indicator ?
    }
    
    但是我被卡住了,怎么能修改 空组的组指示器

  • 什么时候有不同的行为 单击箭头(展开箭头) 组)vs您单击的标题 小组(参加活动)

  • 您必须设置一个具有不同状态的drawable。签出,可能为“state_empty”指定一个空的drawable

  • 只需在drawable文件夹中创建一个group_indicator.xml文件,使用代码指定父状态

    <ExpandableListView
            android:id="@+id/android:list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:groupIndicator="@drawable/group_indicator"
            android:layout_weight="1" >
        </ExpandableListView>
    

    
    

    然后使用代码在可展开列表视图中指定此样式

    <ExpandableListView
            android:id="@+id/android:list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:groupIndicator="@drawable/group_indicator"
            android:layout_weight="1" >
        </ExpandableListView>
    

    我用过这个..但一切都是透明的--这个问题也让chlid知道你有没有找到答案,特别是问题2?谢谢