title: How to set the ActionBar title in middle instead of the default left aligned position?
body: <p>Trying to set the <code>ActionBar</code> title in middle instead of the default left aligned position. To do so, based on other answers this is what I've done:</p>
  
  <pre><code>    Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbarDownloads);
      setSupportActionBar(myToolbar);
      if(getSupportActionBar()!=null)
      {
          getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
          getSupportActionBar().setCustomView(R.layout.actionbar_layout);
      }
  </code></pre>
  
  <p><em>actionbar_layout.xml</em></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:orientation="vertical" &gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Downloads"
          android:layout_centerInParent="true"
          android:textColor="#000000"
          android:id="@+id/mytext"
          android:textSize="18sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>However, this does not produce the intended result <em>(ie this renders the text however still is left aligned)</em>, what's wrong with this approach and how to fix this? </p>