1

I want to create a custom gradient & apply it to the background of a LinearLayout.

Here is code for the gradient:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
  <gradient
      android:startColor="#31527B"
      android:endColor="#20426F"
      android:angle="270"/>
</shape>

I need a gradient as the one below:

enter image description here

Somehow I'm not getting this effect. Am I doing something wrong in terms of angle etc / do I need to apply some more attributes to gradient?

Dave Morris
  • 569
  • 1
  • 8
  • 17

1 Answers1

1

Try putting angle to 90, here you have an example http://www.android10.org/index.php/forums/43-view-layout-a-resource/328-gradient-backgrounds

And here another: Android LinearLayout Gradient Background

Hope this helps...

Community
  • 1
  • 1
oriolpons
  • 1,883
  • 12
  • 20