【问题标题】:How to change color of arrow of expandableListView? [closed]如何更改expandableListView的箭头颜色? [关闭]
【发布时间】:2015-11-22 03:28:49
【问题描述】:

如何更改展开式ListView 下拉箭头的颜色?

最好只改变颜色,这样动画就不会丢失。

【问题讨论】:

  • 您可以使用旧主题中的图标(我假设您知道从哪里获取 android 图形资源)并将它们复制到您的可绘制文件夹中。您还可以在图形编辑器(Gimp、Photoshop、Paint.NET、...)中详细说明它们。没有什么复杂的。
  • 这是什么意思?
  • 在 Windows 中,它们位于 Drive_Letter:\Your_IDE_Install_Path\sdk\platforms\android-*\data\res 中,其中 * 是 API 级别编号。
  • 这些看起来像格式错误的 9 个补丁。请确保扩展名是 .9.png,而不是 .png
  • 是的!它帮助了我!谢谢你!)

标签: android colors styles expandablelistview


【解决方案1】:

不幸的是,我所看到的一切都表明您需要使用自定义可绘制对象,就像这样

<ExpandableListView 
    android:id="@+id/expandableList"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:groupIndicator="@drawable/custom_expandable" />

然后在custom_expandable.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/up_arrow" 
        android:state_empty="true" />
    <item android:drawable="@drawable/down_arrow" 
        android:state_expanded="true" />
</selector>

【讨论】:

  • 我用过,但显示效果不好。就像这张照片:i.stack.imgur.com/HU0J8.png
  • 尝试在右边给 TextView 留一个边距:android:layout_marginRight="?android:attr/expandableListPreferredItemPaddingRight"
  • 我试过了,但是拿这个(postimg.org/image/genbdwq0l
  • 我很困惑。在第一张图片中,它们在右侧,现在它们在左侧。你想达到什么目的?你还想改变颜色吗?还是您担心它们看起来像素化?
  • 很晚了,但对于像我这样使用这个答案的人来说,将图标放在图层列表中以阻止他们像这样进行像素化--> schemas.android.com/apk/res/android" >
猜你喜欢
  • 2020-10-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多