Android中形状的角颜色

问题描述

enter image description here

我知道纯色,也知道边角部分

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

解决方法

尝试在布局文件中使用strokestroke可以为您提供边框的颜色和宽度。

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

Result

,

似乎您在谈论上面图片中的红色。 在这种情况下,没有属性可以给您这样的结果。 您需要在逻辑上做到这一点。,例如,在差异背景下拍摄2个视图,

  1. 红色背景和黑色笔触。
  2. 天空背景在第一个红色视图上重叠。 并简单地将顶视图背景四舍五入为黑色描边。它将为您提供所需的设计布局。

确保两个视图都具有相同的笔触,以使其看起来相同。

快乐的编码。