我怎么可以完全隐藏ExpandableListView的groupIndicator?我怎么、ExpandableListView、groupIndicator

2023-09-05 08:19:25 作者:幼稚ぃ充斥了整个青春

我要完全隐藏在自定义ExpandableListView的groupIndicator。

I want to completely hide the groupIndicator in a custom ExpandableListView.

提供的例子here似乎并没有工作。

The example provided here did not seem to work.

这表明做出选择和使用expList.setGroupIndicator(选择),这是我复制​​:

It suggests making a selector and using expList.setGroupIndicator(selector), which I replicated:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/empty_icon">
    <item android:state_empty="true" android:drawable="@android:color/transparent"/>
    <item android:state_expanded="true" android:drawable="@android:color/transparent" />
    <item android:drawable="@android:color/transparent" />
</selector>

这提供了以下错误 ERROR / AndroidRuntime(10675):android.content.res.Resources $ NotFoundException:由造成资源不是绘制对象(彩色或路径)的TypedValue { T = 0×12 / D =为0x0 A = 2 R = 0x7f0b0013}

同样是使用Android的类似的建议下式给出:ID /空彩的地方/透明

The same is given by the similar suggestion of using android:id/empty in place of color/transparent.

我怎样才能完全隐藏组指标呢?

How can I completely hide the group indicator?

编辑:事实证明,即code没有工作......如果你把它放在绘制资源文件夹而不是布局。

As it turns out, that code DOES work... if you put it in the drawable resource folder instead of layout.

推荐答案

你有没有试图改变 ExpandableListView 的属性安卓groupIndicator =@空

Have you tried changing ExpandableListView's attribute android:groupIndicator="@null"?