android - 在 drawable xml 中应用样式资源

标签 android

我在 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>

最佳答案

关于android - 在 drawable xml 中应用样式资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9563330/

相关文章:

java - 在 Oreo 中识别短信号码 ID

android - 防止 AlertDialog 填满屏幕

javascript - 通过 webview 内的 blob 链接下载 pdf

android - 创建版本 android 签名的 apk 时出现 Proguard 异常

Android TabContent 更改

java - 如果 2 TextView 在 ConstraintLayout 中有长文本,如何缩小第一个 TextView 而不是第二个?

android - 如何在 android 中制作具有自定义布局的 google plus 按钮?

java - 在网页中搜索..Android

android - 如何在不更改新工具栏中的操作溢出菜单文本颜色的情况下更改标题文本和按钮颜色?

android - 如何在android中制作圆圈动画