我有一个shape(rect_shape.xml),它在listview(listview_style.xml)的每个项目中绘制一个笔画轮廓.
此轮廓应具有与当前主题的默认文本颜色相同的颜色.
在XML中,有没有办法将笔画的android:颜色值设置为当前文本颜色?
我在这里看到了一些类似的问题(如How to get my own defined attribute value in my style),试图设置一个自己的属性,但我不认为这就是我想要的.
无论如何我试过但我无法将android:color值设置为我自己定义的属性(android:color =“?custom_stroke_color”抛出InflateException).
因为用户能够动态地在主题之间切换,所以rect_shape.xml中的单个预定义颜色(或对颜色资源的引用,例如@ color / white)不是一种选择.
感谢任何帮助……
rect_shape.xml
android:shape="rectangle" >
android:color="#FFF" />
...
listview_style.xml
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rect_shape" >
...
的themes.xml
...
...