在Android中裁剪背景布局

时间:2019-07-16 15:45:13

标签: android clip

我正在尝试使用XML进行图像背景设计,但未成功。

enter image description here

我的代码如下。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="0"
        android:endColor="@color/bright_sky_blue_95"
        android:startColor="@color/light_indigo_95"
        android:type="linear" />

    <corners android:bottomRightRadius="100dp" />

</shape>

任何想法或例子都很好。 TIA。

1 个答案:

答案 0 :(得分:0)

Change the colours as per your need.

<?xml version="1.0" encoding="utf-8"?>
    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:aapt="http://schemas.android.com/aapt"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="302"
        android:viewportHeight="472">
        <path android:pathData="M0,122.9c0,108.3 0.2,123 1.5,123.5 0.8,0.3 1.5,0.1 1.5,-0.5 0,-0.6 0.9,-0.8 2.1,-0.4 1.6,0.5 1.9,0.4 1.4,-0.5 -0.5,-0.9 -0.1,-1 1.5,-0.5 1.6,0.5 2,0.4 1.5,-0.5 -0.5,-0.9 -0.2,-1 1.4,-0.5 1.3,0.4 2.1,0.2 2.1,-0.5 0,-0.7 0.7,-1 1.5,-0.6 0.8,0.3 1.5,0.1 1.5,-0.5 0,-0.6 0.9,-0.8 2.1,-0.4 1.6,0.5 1.9,0.4 1.4,-0.5 -0.5,-0.9 -0.2,-1 1.4,-0.5 1.2,0.4 2.1,0.2 2.1,-0.4 0,-0.6 0.7,-0.8 1.5,-0.5 0.8,0.4 1.5,0.1 1.5,-0.6 0,-0.7 0.8,-0.9 2.1,-0.5 1.6,0.5 1.9,0.4 1.4,-0.5 -0.5,-0.9 -0.1,-1 1.5,-0.5 1.6,0.5 2,0.4 1.5,-0.5 -0.5,-0.9 -0.2,-1 1.4,-0.5 1.3,0.4 2.1,0.2 2.1,-0.5 0,-0.7 0.7,-1 1.5,-0.6 0.8,0.3 1.5,0.1 1.5,-0.5 0,-0.6 0.9,-0.8 2.1,-0.4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360"
                    android:endY="208"
                    android:startX="0"
                    android:startY="0"
                    android:tileMode="repeat"
                    android:type="linear">
                    <item
                        android:color="#1976d2"
                        android:offset="0" />
                    <item
                        android:color="#EF5350"
                        android:offset="0.5" />
                </gradient>
            </aapt:attr>
        </path>
    </vector>