Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradient on Lollipop not working. - API 21

When I try to use Gradient on Lollipop, it doesnt work. While it works on all previous versions.

Here is my example:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:type="radial" android:gradientRadius="500"
    android:startColor="#00417e" android:endColor="#001b34" />

like image 585
Daniel Benedykt Avatar asked Dec 09 '14 17:12

Daniel Benedykt


Video Answer


1 Answers

I had the same problem and created 2 different files:

in drawables

android:gradientRadius="270"

and in drawables-v21

android:gradientRadius="270dp"

Now it works fine.

like image 117
Dmitry Avatar answered Nov 15 '22 22:11

Dmitry