androidxmldrawablegradientradial

Android background gradient radial


I want that my app have a background gradient radial, and i Think I did it, but in runtime my app show just one color.

Here my drawable background

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

<gradient
    android:type="radial"
    android:gradientRadius="360"
    android:startColor="@color/color_start"
    android:endColor="@color/color_end" />

And I call it in my activity XML in this way:

android:background="@drawable/background_app"

PD:Sorry about my bad English


Solution

  • android:gradientRadius="250" will be ignored. You should point to a dimen resource with a px or dp value, like: android:gradientRadius="@dimen/gradient_radius"