我在 res/values/styles.xml 中有这个
<style name="ListViewRowBorder" >
<item name="android:width">1dp</item>
<item name="android:color">@color/listview_row_stroke_color</item>
</style>
我能够访问颜色资源。如何在 res/drawable/file.xml 中访问此样式资源(如下所示) 我在下面尝试的方法似乎不起作用。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/list_item_dark_background"/>
<stroke style="@style/ListViewRowBorder" />
</shape>
</item>
最佳答案
我不认为你可以使用笔划样式,请看一下:
http://developer.android.com/guide/topics/resources/drawable-resource.html#stroke-element
关于android - 在 drawable xml 中应用样式资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9563330/