No full toolbar in Android studio?

I use the toolbar in my application and customize textview as the center of the toolbar, but it is not the full width of the toolbar screen, and a small screen is reserved on the left, as shown in the figure below. So, how to make "customize textview" the center of the screen and toolbar?

My current screen problem:

Screen I want:

<?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorPrimary"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"
        xmlns:app="http://schemas.android.com/apk/res-auto">
        <TextView
            android:id="@+id/tv_title"
            android:textColor="#FFF"
            android:background="#F00"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="TITLE"
            android:textStyle="bold"
            android:textSize="15sp"
            android:gravity="center"/>
    </android.support.v7.widget.Toolbar>

thank you!

resolvent:

Add the following properties to your toolbar to remove the left fill

 app:contentInsetLeft="0dp"
 app:contentInsetStart="0dp"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>