带有 2 个笔划和渐变的圆圈

fai*_*jua 0 android

  1. 如何绘制像附加图像一样的形状。

    <?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <stroke
        android:width="8dp"
        android:color="#00A79E"/>
    
    <solid
        android:color="#e5e5e5"/>
    
    Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

  1. 使用 9-Patch Image 给我损坏的图像 在此处输入图片说明

Fen*_*tel 9

您可以使用Layer-list根据您的需要实现布局

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <stroke android:color="#24744f" android:width="10dp"/>
            <solid android:color="#fff"/>
        </shape>
    </item>
    <item android:top="10dp" android:bottom="10dp" android:left="10dp" android:right="10dp">
        <shape android:shape="oval">
            <gradient android:angle="90" android:startColor="@color/colorPrimary"/>
            <stroke android:color="#fff" android:width="10dp"/>
        </shape>
    </item>

    <item
        android:bottom="40dp"
        android:drawable="@drawable/ic_launcher_foreground"
        android:left="40dp"
        android:right="40dp"
        android:top="40dp" />
</layer-list>
Run Code Online (Sandbox Code Playgroud)

结果看起来像附加的图像,

在此处输入图片说明