【问题标题】:Disable highlight in ExpandableListView在 ExpandableListView 中禁用突出显示
【发布时间】:2023-03-17 23:10:02
【问题描述】:

我一直试图禁用 ExpandableListView 中的突出显示。我尝试将下一个可绘制对象设置为背景,但这不起作用。

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@color/_GREY_Weak"/>

<item android:drawable="@color/_GREY_Weak"
    android:state_pressed="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_selected="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_focused="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_checked="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_long_pressable="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_hovered="true" />

<item android:drawable="@color/_GREY_Weak"
    android:state_expanded="true" />
</selector>

我尝试将每个可绘制状态设置为该颜色、@null 或透明,但仍然相同。这是我的问题的一些屏幕截图。我想像在父母身上一样摆脱孩子身上的那个亮点。

我也尝试在 ExpandableListView xml 中设置属性 drawingCacheHint,但没有成功。

【问题讨论】:

  • 橙色高亮效果是ExpandableListView上的一种样式。您需要覆盖 ExpandablelistView 样式。您是否尝试过 ExpandableListView xml 中的 android:listSelector="@android:color/transparent"
  • 谢谢你成功了!如果你想发表你的评论作为答案,我可以检查它是否有用。
  • 很高兴它成功了。我发布了答案。

标签: android xml listview expandablelistview


【解决方案1】:

尝试添加

 android:listSelector="@android:color/transparent"

在 ExpandableListView xml 中

或者覆盖 ExpandableListView 样式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-21
    • 1970-01-01
    • 2014-12-17
    • 1970-01-01
    • 2015-10-30
    • 2015-07-11
    • 2014-11-12
    相关资源
    最近更新 更多