像这样的渐变?

ram*_*ixp 4 xml user-interface android

我不是UI设计师,所以我感觉不到xml颜色,我想做这样的渐变:

http://t1.uccdn.com/en/images/6/5/2/img_2256_ins_45517_600.jpg

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape>
        <gradient
            android:startColor="#1f313d"

            android:endColor="#2c3942"
            android:angle="135"/>
    </shape>
</item>
Run Code Online (Sandbox Code Playgroud)

但是......我认为2种颜色还不够,如何使它与此图像相似?*最后一个屏幕

sus*_*dlh 8

如何创建渐变?

创建渐变很容易

  1. 右键单击drawable文件夹并创建xml文件.

  2. 创建形状标签

  3. 内部形状标签创建渐变标签

渐变属性........

android:startColor="put here your color"
android:endColor="put here your color"
android:centerColor="put your color here"
android:angle="45"
Run Code Online (Sandbox Code Playgroud)

如果你需要渐变

水平方式放角度="0"

垂直方式放角度="90"

拐角水平方式放角度="45"

与角水平方向相反放角度="135"

用这个 .......

<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <gradient android:startColor="#915d5b"
        android:endColor="#418c47"
        android:angle="45"></gradient>
</shape>
Run Code Online (Sandbox Code Playgroud)

产量

喜欢编码.......