title: Android how to create gradient shadow on left and right of view?
body: <p>I cannot use Lollipop <code>elevation</code> property because I need to target devices from API 18.</p>
  
  <p>I need to place a shadow on the right and left side of a view.</p>
  
  <p>This is what I tried so far : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle" &gt;
  
      &lt;item&gt;
          &lt;shape &gt;
              &lt;!-- set the shadow color here --&gt;
              &lt;stroke
                  android:width="2dp"
                  android:color="#7000" /&gt;
  
              &lt;!-- setting the thickness of shadow (positive value will give shadow on that side) --&gt;
  
              &lt;padding
                  android:bottom="0dp"
                  android:left="2dp"
                  android:right="2dp"
                  android:top="0dp" /&gt;
  
              &lt;corners android:radius="3dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  
      &lt;!-- Background --&gt;
  
      &lt;item&gt;
          &lt;shape&gt;
              &lt;solid android:color="@color/salmon" /&gt;
              &lt;corners android:radius="3dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>I tried adding <code>gradients</code> in the first item, but it spreads from left to right which is not what I am looking fo. Is there a way to isolate two unique gradients for each side ?</p>
  
  <p>This is what I am trying to do : </p>
  
  <p><a href="https://i.stack.imgur.com/XCIcO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XCIcO.png" alt="enter image description here"></a></p>