0

I want to align my ToolBar Text to the center while keeping the triple dot menu at the end but I can't find a way to do it. Whenever I change gravity entire gravity changes.

My layout Image: layout image

Layout Code:

    <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:layout_alignParentStart="true"
            android:layout_gravity="center|top"
            android:background="#fff"
            app:elevation="0dp">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/main_toolbar"
                android:layout_width="wrap_content"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="end"
                android:background="#fff"
                app:title="CENTER">

            </androidx.appcompat.widget.Toolbar>

    </com.google.android.material.appbar.AppBarLayout>
Shahadat Hossain
  • 533
  • 7
  • 20

1 Answers1

1

Set width to match_parent for both of the them.

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
Murtadha S.
  • 442
  • 6
  • 15