gpt4 book ai didi

android - 形状虚线,破折号不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:02 26 4
gpt4 key购买 nike

我想使用 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>

在我的设备上我看到了这个: enter image description here但我需要这样的东西:

enter image description here

如何解决?

最佳答案

试试这个

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com