渐变画不起作用

时间:2013-01-07 13:40:57

标签: android drawable

我正在尝试创建一个从中心向外的渐变。 (或向内)。所以外面是相同的颜色,当你靠近中心时,它会变成红色或其他东西。

<?xml version="1.0" encoding="utf-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    >

    <gradient 
          android:startColor="#ffffff"
            android:endColor="#ff00ff00"
            android:centerX="50%"
            android:centerY="50%"
            android:gradientRadius="50%"
            android:type="radial"
        />
</shape>

enter image description here

1 个答案:

答案 0 :(得分:2)

尝试这样做

    <gradient android:type="radial" android:gradientRadius="50"
    android:startColor="#ffffff"
        android:endColor="#ff00ff00" />

基本上尝试没有gradientRadius的百分比

相关问题