When I try to use Gradient on Lollipop, it doesnt work. While it works on all previous versions.
Here is my example:
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < Build.VERSION_CODES.LOLLIPOP) {
//in your gradient use android:gradientRadius="500"
} else {
// in your gradient use android:gradientRadius="80%p" or
// android:gradientRadius="200dp"
Try write two different xml files using different gradientRadius style
Seems I found another workaround - set gradient background in code:
findViewById(R.id.bg).setBackground(ContextCompat.getDrawable(context,R.drawable.bg_gradient));
It is a bug. Check this here: https://code.google.com/p/android/issues/detail?id=77862
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.
use like this will be fine:
android:gradientRadius="50%p"