What is the Default ActionBar Title Font Size?
Seems to be 17dip. Just want to confirm it if anyone knows the exact size.
The short one…
$ grep ActionBar platforms/android-11/data/res/values/*
leads to
styles.xml:
<style name="TextAppearance.Widget.ActionBar.Title"
parent="@android:style/TextAppearance.Medium">
</style>
<style name="TextAppearance.Widget.ActionBar.Subtitle"
parent="@android:style/TextAppearance.Small">
</style>
[…]
<style name="TextAppearance.Medium">
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.Small">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
This works for me.
This is what I do to get the default toolbar style:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_top"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="@color/primary_dark">
<TextView
android:id="@+id/toolbar_title"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
This does the trick to keep the default style style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
Then in your activity, you can do:
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
TextView mTitle = (TextView) toolbarTop.findViewById(R.id.toolbar_title);
mTitle.setText("Custom...");