Android L 无法绘制虚线作为可绘制背景,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="line" >
<stroke
android:dashGap="1dp"
android:dashWidth="1dp"
android:color="#999999" />
<size android:height="1dp" />
</shape>
</item>
</selector>
我还在 xml 中使用 layerType='software'。 请帮忙。
最佳答案
1. View 的高度必须至少为 2dp(或 wrap_content
),以便显示,因为笔划设计为围绕 View 而没有空间在 1dp 中这样做。
2. 为您的 xml 添加宽度:
<stroke
android:width="1dp"
android:dashGap="1dp"
android:dashWidth="1dp"
android:color="#999999" />
<size android:height="1dp"
android:width="1dp"/>
3.使用layerType='software'
关于xml - Android L 无法绘制虚线作为可绘制背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24536617/