android - ToolBar widget did not take full width
<p>I'm learning android right now, quite newbe here,
and confused about ToolBar, been reading everything else, but doesn't seem to work for me.
in MainActivity the toolbar work fine, the button in the toolbar goes to the right without padding
but when i move to the other activity
the button did not placed in the right as if there's a padding there,</p>

<p>here is my toolbar.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.design.widget.AppBarLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
&gt;
   &lt;android.support.v7.widget.Toolbar
       android:id="@+id/toolbar"
       android:layout_width="match_parent"
       android:layout_height="?attr/actionBarSize"
       android:background="#5f0e92"
       app:popupTheme="@style/AppTheme.PopupOverlay" /&gt;
&lt;/android.support.design.widget.AppBarLayout&gt;
</code></pre>

<p>my second activity</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"&gt;
&lt;include layout="@layout/toolbar"
    android:id="@+id/include"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    /&gt;
&lt;ScrollView
    android:id="@+id/scrollOff"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:layout_above="@+id/TotShow"
    android:layout_below="@+id/include"
    android:visibility="gone"&gt;
    &lt;TableLayout
        android:layout_width="match_parent" android:layout_height="32dp"
        android:gravity="center_horizontal"
        android:id="@+id/tableLayoutOff"
        android:stretchColumns="*"&gt;
    &lt;/TableLayout&gt;
&lt;/ScrollView&gt;
&lt;TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:text="Small Text"
    android:id="@+id/TotShow"
    android:layout_gravity="center_horizontal"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>onCreate function i put this </p>

<pre><code>Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
</code></pre>

<p>------------edit----------------</p>

<p>forgot about the button/toggle
toggle.xml</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:gravity="right"&gt;
&lt;Button
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/button"
    android:background="@android:drawable/ic_menu_help"
    android:layout_alignParentTop="true"
    android:layout_toLeftOf="@+id/actionbar_service_toggle"
    android:layout_toStartOf="@+id/actionbar_service_toggle" /&gt;
&lt;ToggleButton
    android:id="@+id/actionbar_service_toggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textOff="inchi"
    android:textOn="milli"
    android:gravity="right"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" /&gt;

   &lt;/RelativeLayout&gt;
</code></pre>

<p>customview :</p>

<pre><code>    ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.togle);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);
</code></pre>

<p>in my MainActivity, this work perfectly fine</p>

<p><a href="https://i.stack.imgur.com/p3QWm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p3QWm.png" alt="first mainactivity"></a></p>

<p>in second activity there seem to be right padding</p>

<p><a href="https://i.stack.imgur.com/iavTo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iavTo.png" alt="second activity"></a></p>