我想使用 shape
制作虚线。
这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="line">
<stroke android:color="@color/grey_divider"
android:width="1dip"
android:dashWidth="5dip"
android:dashGap="13dip"/>
</shape>
</item>
</selector>
如何解决?
最佳答案
试试这个
在drawable中制作一个xml文件。(例如dashed_line.xml)
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#C7B299"
android:dashWidth="10px"
android:dashGap="10px"
android:width="1dp"/>
</shape>
现在在您的布局中使用此 xml 文件。
android:background="@drawable/dashed_line"
关于android - 形状虚线,破折号不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41378934/