title: Preparing custom action bar
body: <p>I am trying to get exactly like the below image.</p>
  
  <p><img src="https://i.stack.imgur.com/vmYOM.png" alt="enter image description here"></p>
  
  <p>But I am able to get the below one right now. Here I have two questions. </p>
  
  <p><strong>1)</strong> How to make this <code>actionbar</code> to be worked on all activities instead of single activity that I am inflating now.</p>
  
  <p><strong>2)</strong> The above image seems like elevated layout bar, but mine looks like a normal panel. Can some one please help me how to achieve these? Code snippets are appreciated. </p>
  
  <p><strong>My current output:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/62lBR.png" alt="enter image description here"></p>
  
  <p><strong>My layout code to inflate to actionbar:</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:gravity="center_vertical"
      android:background="@drawable/ab_customshape" &gt;
  
      &lt;ImageButton
              android:id="@+id/homeicon"
              android:layout_width="40sp"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:src="@drawable/ic_launcher"
              android:layout_alignParentTop="true"
              android:layout_alignParentLeft="true" &gt;
       &lt;/ImageButton&gt;
  
      &lt;TextView
          android:id="@+id/title_text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="My Title"
          android:layout_centerVertical="true"
          android:textColor="#ffffff"
          android:textSize="20sp"
          android:textStyle="bold" /&gt;
      &lt;ImageButton 
          android:id="@+id/rightbutton"
              android:layout_width="40sp"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:src="@drawable/ic_launcher"
              android:background="@android:color/transparent"
              android:layout_alignParentTop="true"
              android:layout_alignParentRight="true" 
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Activity code snippets:</strong></p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          initActionBar();
      }
  
      private void initActionBar() {
          mActionBar = getSupportActionBar();
          mActionBar.setDisplayShowHomeEnabled(false);
          mActionBar.setDisplayShowTitleEnabled(false);
          mInflater = LayoutInflater.from(this);
          mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
          mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
          mTitleTextView.setText("My Own Title");
          mActionBar.setCustomView(mCustomView);
          mActionBar.setDisplayShowCustomEnabled(true);
      }
  </code></pre>
  
  <p><strong>@drawable/ab_customshape:</strong></p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle" &gt;
  
      &lt;gradient
          android:angle="-90"
          android:endColor="#DD2ECCFA"
          android:startColor="#DD000000"
          android:type="linear" /&gt;
  
  &lt;/shape&gt;
  </code></pre>