Android L无法将虚线绘制为可绘制背景 [英] Android L is not able to draw dotted line as drawable background
本文介绍了Android L无法将虚线绘制为可绘制背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Android L无法将虚线绘制为可绘制背景,如下所示:
Android L is not able to draw dotted line as drawable background as below:
<?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'. 请帮助.
I am also using layerType='software' in xml. Kindly help.
推荐答案
1.视图的高度必须至少为2dp(或wrap_content
),以使其显示,因为笔划被设计为绕过笔划视图,并且在1dp中没有空间.
1.The view must be at least 2dp in height (or wrap_content
), in order for it to display since a stroke is designed to go around the view and it doesn't have room to do so in 1dp.
2.为您的xml添加宽度:
2.Add width to your xml:
<stroke
android:width="1dp"
android:dashGap="1dp"
android:dashWidth="1dp"
android:color="#999999" />
<size android:height="1dp"
android:width="1dp"/>
3.使用layerType='software'
这篇关于Android L无法将虚线绘制为可绘制背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文