I've added the toolbar to my Android app following the guidelines of this page: *https://developer.android.com/training/implementing-navigation/nav-drawer#java * The following xml code was added to my layout xml file:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
I do get the toolbar on my app. But I really want to move the "title" of the toolbar to the center. The "title" is the name of my app. I want to change its gravity and appearance. So, I tried the following changes to the xml code, but with no success.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:text="MySolvingApp"
android:fontFamily="@font/cutive"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
How can I access this piece of text and change its properties and appearance? Is it possible to access it via the xml layout or via code.
Thanks for any suggestions