首页 > 解决方案 > android中形状的角颜色

问题描述

在此处输入图像描述

我知道纯色和角落部分,但

我想知道如何填充角落的颜色

标签: androidbackgroundshapes

解决方案


尝试stroke在您的布局文件中使用。stroke可以给你边框颜色和宽度。

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <stroke android:color="@color/yourcolour"
        android:width="4dp"
        />
    //Other adjustments


</shape>

让我知道这是否是您要找的

或者,如果您想要图像中的内容,请尝试以下操作

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item >
        <shape android:shape="rectangle">
            <solid android:color="@android:color/holo_red_dark"/>
                <stroke android:color="@android:color/black"
                    android:width="10dp"
                    />

        </shape>

    </item>

    <item >
        <shape android:shape="rectangle">
            <solid android:color="@android:color/holo_blue_bright"/>
            <stroke android:color="@android:color/black"
                android:width="10dp"
                />

            <corners android:bottomLeftRadius="150dp"/>

        </shape>

    </item>



</layer-list>

结果


推荐阅读