Reputation: 127
I'm trying to make a gradient effect for my ListView
item background.
So I created a new drawable XML with the following content:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:centerX="10%"
android:startColor="#FF0000"
android:endColor="#FFFFFF"
android:angle="0" />
But it seems that the centerX
attribute isn't working since the centerX
point is still at 50%. And if I change centerX
to any other value no changes are made.
I also tried to use decimal numbers (0.1) but still no success.
Thank you very much :)
Upvotes: 1
Views: 887
Reputation: 19427
In case of a linear gradient the centerX
attribute corresponds to the position of the centerColor
(which you did not define).
Something like this should work:
<gradient
android:startColor="#FF0000"
android:centerColor="#FF0000"
android:centerX="10%"
android:endColor="#FFFFFF" />
Upvotes: 1