Android 实现三色渐变背景

在drawable文件夹中新建一个selector文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <!--实现应用背景颜色横向渐变-->
    <gradient
        android:startColor="#FC2F58"
        android:centerColor="#FD253C"
        android:endColor="#E20E24"
        android:angle="0"/>
    <corners android:radius="5dp" />
</shape>

angle:渐变角度,值要为45的倍数

startColor:开始颜色

centerColor:中间颜色

endColor:结束颜色

radius:圆角

效果图:

猜你喜欢

转载自blog.csdn.net/L73748196_/article/details/127559951