Here's my styles.xml file.
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary4</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark4</item>
<item name="colorAccent">@color/colorAccent2</item>
<item name="android:fontFamily">fonts/HelveticaNeue-Light.ttf</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.Widget" />
<style name="AppTheme.Widget.TextView" parent="android:Widget.Holo.Light.TextView">
<item name="android:fontFamily">fonts/HelveticaNeue-Light.ttf</item>
</style>
</resources>
And this is the layout file that contains the toolbar.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".HomeActivity">
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_home" />
</android.support.design.widget.CoordinatorLayout>
So, The toolbar
is using the AppTheme.PopOverlay
theme which is defined in the styles.xml
file.
Currently the title on the toolbar is set as the default app name, and I wanted to change the title, so I already tried to include the <item name="android:text">@string/customtitle</item>
attribute in the AppTheme.PopOverlay
theme. It didn't work.
Now started to wonder, how is the title defined by default as the app name, and how I can change it.
Added What I want to find out fundamentally from this question is, how the title is set by default with the app name in the toolbar even though it is not defined in any parts of the XML files, AndroidManifest.xml or in the codes.