I have created an ActionBar (android.support.v7.widget.Toolbar
) as below.
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
In my ActionBar, other than the title, I also have Subtitle. However I would like to customize the Subtitle. In customize, I mean the font size, color and typeface.
I've tried through various Theme and Style, and still unsuccessful.
If there's a simple complete example of how that could be done, that would really help. Thanks!
If you don't already have this namespace attribute in your layout file add it:
xmlns:app="http://schemas.android.com/apk/res-auto"
Update your Toolbar attributes in your layout file like this:
Add styles like these:
Comments on this answer discuss whether the units for
textSize
should bedp
orsp
. When I originally wrote this answer, I looked at the Android source files and saw thatdp
was used. I recommend staying with that. As FrancescoDonzello explains in his comment, the size of the Toolbar is fixed and, unlike other widgets, will not expand to contain text enlarged by changes to the phone settings.