title: Android gradient background
body: <p>I need to implement something like this, with black gradient effect at the bottom
  <a href="https://i.stack.imgur.com/Nh4pQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nh4pQ.png" alt="Image"></a></p>
  
  <p>I used the below code 
  activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="200dp"
      android:layout_marginBottom="5dp"
      android:background="@drawable/my_custom_drawable"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:src="@drawable/dead"
          android:scaleType="fitXY"
          android:id="@+id/place_image"
          /&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="50dp"
          android:layout_alignParentBottom="true"
          android:background="#AA000000"&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Medeu"
              android:id="@+id/place_id"
              android:layout_marginLeft="20dp"
              android:layout_marginTop="2dp"
              android:textSize="18sp"
              android:textColor="#ffffff"/&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Almaty region"
              android:textColor="#ffffff"
              android:layout_marginLeft="20dp"
              android:layout_below="@+id/place_id"
              android:textSize="12sp"
              android:id="@+id/place_id_sub"
  
              /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and my_custom_drawable.xml</p>
  
  
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;gradient
          android:startColor="#00000000"
          android:endColor="#80000000"
          android:angle="270"
          android:dither="true"
          /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>I end up getting like this</p>
  
  <p><a href="https://i.stack.imgur.com/jaoAc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jaoAc.jpg" alt="Image 2"></a></p>
  
  <p>Why am I not getting the effect as first image, I referred several top answers from other questions </p>