3

I'm trying to set a radial linear background on my app. I currently have it working on the preview, but when I run my app on my Samsung Galaxy S4 it makes the whole background just the starting color.

Preview look:

enter image description here

Samsung Galaxy S4 look:

enter image description here

Here is my XML file:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <gradient
        android:type="radial"
        android:startColor="#f3e5f5"
        android:endColor="#9c27b0"
        android:gradientRadius="600"
        android:angle="270"
        android:centerX="50%"
        android:centerY="20%"/>

</shape>

Any idea what's wrong?

Smreks
  • 317
  • 1
  • 7
  • 19

2 Answers2

0

It is a bug. Check this here: https://code.google.com/p/android/issues/detail?id=77862

Melad
  • 1,184
  • 14
  • 18
0

I found another workaround for it - set gradient background in code:

findViewById(R.id.bg).setBackground(ContextCompat.getDrawable(context,R.drawable.bg_gradient));
Natasha
  • 973
  • 9
  • 24