xuexiangjys / XUI

💍A simple and elegant Android native UI framework, free your hands! (一个简洁而优雅的Android原生UI框架,解放你的双手!)
https://xuexiangjys.github.io/XUI/
Apache License 2.0
4.88k stars 838 forks source link

XUICommonListItemView 无法修改背景色(实现暗黑模式) #168

Closed Dylan-H closed 1 year ago

Dylan-H commented 1 year ago

1、尝试修改style方式 通过在自己的style 中定义 XUICommonListItemViewStyle 向本地的 style

<item name="XUICommonListItemViewStyle">@style/MyCommonListItemView</item>

在自定义sytle 中重新指定新的背景颜色 或者drawable ,背景始终是白色, PS:下面的字体颜色是生效的

<style name="MyCommonListItemView" parent="XUICommonListItemView">
        <item name="android:background">@color/red_end</item>
        <item name="xui_commonList_titleColor">@color/green_end</item>
 </style>

2 .尝试在demo程序中直接修改

xui_lib/src/main/res/drawable/xui_list_item_bg_with_border_none_selector.xml xui_lib/src/main/res/drawable-v17/xui_list_item_bg_with_border_none_selector.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/xui_config_color_red" android:state_pressed="true"/>
    <item android:drawable="@color/xui_config_color_black"/>
</selector>

颜色依然是白色背景

xuexiangjys commented 1 year ago

已解决: https://github.com/xuexiangjys/XUI/commit/ec89b7d1b5d305f974511c09a8f41d7855ac41c8