android - 可绘制圆形四色边框

标签 android android-drawable

是否可以使用图层列表实现以下可绘制对象(用于背景)???

enter image description here

最佳答案

对于图层列表使用:

 <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <size
                android:width="56dp"
                android:height="56dp" />

            <stroke
                android:width="10dp"
                android:dashGap="20dp"
                android:color="#0000ff" />
        </shape>
    </item>
    <item>
        <shape android:shape="oval">
            <size
                android:width="25dp"
                android:height="24dp" />

            <stroke
                android:width="10dp"
                android:color="#FF0000"
                android:dashGap="20dp"
                android:dashWidth="10dp" />
        </shape>
    </item>

</layer-list>

输出:

enter image description here

相应地更改破折号间隙和笔划宽度..

关于android - 可绘制圆形四色边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47693279/

相关文章:

php - 如何使用 MIT appinventor 2 和 php 将图像插入 MYSQL 数据库?

java - 创建数据库时将数据添加到sqlite数据库

android - 在 Android 上构建时为 "error in backend: Undefined temporary symbol"

android - 如何使用圆角 BitmapDrawable

android - 如何获得一个不同 Drawable 的镜像版本的 Drawable?

android - 缩放图像在背景可绘制中保持其纵横比

javascript - 如何创建 android webview 将我的位置共享到网站?

android - 在 Google 室内地图上显示地名

android - android 4.4新增的mipmap文件夹应该如何使用?

android - 如何在android中画一条圆线