...

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ff5c00">
 
        <TextView
            android:id="@+id/txv_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="TOOLBAR"
            android:textColor="#ffffff"
            android:textSize="20sp" />
 
 
</android.support.v7.widget.Toolbar>
cs

위와 같이 툴바에 텍스트를 넣고 가운데 정렬을 해보면 약간 우측으로 정렬 되는데요

아래와 같이 툴바에 app:contentInsetStart="0dp" 옵션을 추가 하면 가운데 정렬을 할수 있습니다


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:contentInsetStart="0dp"
        android:background="#ff5c00">
 
        <TextView
            android:id="@+id/txv_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="TOOLBAR"
            android:textColor="#ffffff"
            android:textSize="20sp" />
 
 
</android.support.v7.widget.Toolbar>
cs


반응형