title: How to add shadow under custom action bar in pre-lollipop device?
body: <p>I have a custom action bar defined in <code>layout_action_bar.xml</code> (refer below). In every fragment, if I want to use that action bar, I will use it like a custom widget in their respective xml layout file.</p>
  
  <p>I have tried the below methods to add a shadow below the action bar:</p>
  
  <ol>
  <li>Used <code>android:elevation</code> (refer below) but it did not work on pre-lollipop device.</li>
  <li>Used custom view as shadow after the navigation bar (refer below) but the shadow inserted will disrupt the display of contents below the action bar. I want the shadow to overlay the content.</li>
  <li>There are methods mentioned in stackoverflow such as using the <code>CardView</code> widget to create a shadow effect but I do not want my custom action bar to become a card view.</li>
  </ol>
  
  <p><strong>layout_action_bar.xml :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:elevation="10dp"&gt;
  
      &lt;RelativeLayout
          android:id="@+id/actionbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          ...ImageView and TextView for action bar...
  
      &lt;/RelativeLayout&gt;
  
      &lt;View
          android:layout_below="@id/actionbar"
          style="@style/shadowStyle"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Example on how I use the custom action bar in a fragment's layout xml file :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;com.test.views.CustomActionBarView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/&gt;
  
      ...fragment's content here...
  
  &lt;/LinearLayout&gt;
  </code></pre>