pgsandstrom pgsandstrom - 1 year ago 98
Android Question

Circular gradient in android

Im trying to make a gradient that emits from the middle of the screen in white, and turns to black as it moves toward the edges of the screen.

As I make a "normal" gradient like this, I have been experimenting with different shapes:

<shape xmlns:android=""
<gradient android:startColor="#E9E9E9" android:endColor="#D4D4D4"

When using the "oval"-shape I at least got a round shape, but there were no gradient effect. How can I achieve this?


Answer Source

You can get a circular gradient using android:type="radial":

<shape xmlns:android=""
    <gradient android:type="radial" android:gradientRadius="250"
        android:startColor="#E9E9E9" android:endColor="#D4D4D4" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download