如何在android中创建圆形虚线

问题描述 投票:0回答:1

我需要用圆点创建一条线。我尝试创建可绘制对象并将此可绘制对象设置为视图组件的背景。但目前我可以用正方形创建一条线,但我不知道如何更改我的代码以获得圆点。 下面是我用 Square 创建的代码。

`<layer-list>
  <item
    android:left = "-600dp"
    android:right = "-600dp">
     
     <rotate
       android:fromDeegres = "90"
       android:toDeegres = "90">

       <shape 
         android:share = "line" >

          <stroke 
            android:width = "3dp"
            android:dashWidth = "3dp"
            android:dashGap = "4dp"/>

        </shape>
       </rotate>
    </item>
</layer-list>`

我尝试使用上面的代码创建它。 我需要创建这样的东西enter image description here

java android xml kotlin solution
1个回答
0
投票

您可以与库一起使用或使用自定义库代码

https://github.com/Comcast/DahDit

希望对你有用!!

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.