Android 渐变颜色 - 结果不正确

ali*_*ali 2 android gradient colors

我想创建一个重复图像的背景,并在它上面添加从白色到透明的渐变。因此,它应该从视图顶部的全白开始,然后在底部完全透明,在那里可以完全看到背景图像。我的代码:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
    <bitmap 
        android:dither="true" 
        android:src="@drawable/bg" 
        android:tileMode="repeat" >
    </bitmap>
</item>
<item>
    <shape>
        <gradient 
            android:angle="90" 
            android:endColor="#ffffffff" 
            android:startColor="#00000000" />
    </shape>
</item>
Run Code Online (Sandbox Code Playgroud)

问题是我没有得到从白色(#ffffff)到透明的渐变,而是从灰色到透明的渐变。使用颜色选择器,我得到了endColor的代码它是 #dfdfdf。

为什么会出错?谢谢!

屏幕截图: 在此处输入图片说明

规格

我以一种风格使用这个背景:

<resources>
<style name="Theme.NoBackground" parent="android:Theme">
    <item name="android:windowBackground">@drawable/background</item>"
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)