Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not full width toolbar in android studio?

I am using Toolbar in my app and I custom the TextView to the center of the Toolbar but it not full width of the screen of toolbar and remain a little screen at the left side like the picture below. So how can I do to make the Custom TextView to the center of the screen and Toolbar?

My current screen problem :

enter image description here

The screen I want :

enter image description here

<?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!

like image 544
user7408943 Avatar asked Mar 17 '17 02:03

user7408943


1 Answers

In your ToolBar add below property to remove Left Padding.

 app:contentInsetLeft="0dp"
 app:contentInsetStart="0dp"
like image 126
Harshad Pansuriya Avatar answered Nov 11 '22 12:11

Harshad Pansuriya