title: Add custom view to the right of toolbar
body: <p>I am trying to achieve this(A timer in <code>toolbar</code> with red background):</p>
  
  <p><a href="https://i.stack.imgur.com/OTKuTm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OTKuTm.png" alt="A timer in the toolbar along with red background"></a></p>
  
  <p>I am trying to add <code>customView</code> in <code>toolbar</code>. It always end's up being on extreme left just beside the back arrow. Like the text <code>YP</code> in image below is a custom <code>Textview</code> added to toolbar.<a href="https://i.stack.imgur.com/mfC4r.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mfC4r.png" alt="enter image description here"></a>.</p>
  
  <p>The code for <code>toolbar</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.Toolbar
      android:id="@+id/base_activity_toolbar"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="?attr/colorPrimary"
      android:elevation="4dp"
      android:minHeight="?attr/actionBarSize"
      android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /&gt;
  </code></pre>
  
  <p>The code for adding the layout:</p>
  
  <pre><code>    LayoutInflater mInflater= LayoutInflater.from(context);
      View mCustomView = mInflater.inflate(R.layout.textview, null);
      toolbar.addView(mCustomView);
  </code></pre>
  
  <p>This is the layout I am adding right now for testing:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:gravity="end"
                android:layout_height="wrap_content"&gt;
      &lt;TextView android:layout_width="wrap_content"
                android:text="yp"
                android:layout_height="wrap_content"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I am missing something majorly, could not figure out. Pulling my hairs out.</p>