How to change the toolbar text size? How to change the toolbar text size? android android

How to change the toolbar text size?


Use app:titleTextAppearance:

<android.support.v7.widget.Toolbar    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:layout_width="match_parent"    android:layout_height="?actionBarSize"    android:id="@+id/toolbar"    app:titleTextAppearance="@style/Toolbar.TitleText" />

and override the default title size in a custom style:

<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">    <item name="android:textSize">18sp</item></style>

Result:

Screenshot


for example this your toolbar

<android.support.v7.widget.Toolbar    android:id="@+id/toolbar"    android:layout_width="match_parent"    android:layout_height="?attr/actionBarSize"    android:background="?attr/colorPrimary"    android:gravity="center"    android:minHeight="?attr/actionBarSize"    app:theme="@style/ThemeOverlay.AppCompat.ActionBar" />

you can simple add this view this

    app:titleTextAppearance="@style/yourstyle"

style.xml

  <style name="yourstyle" parent="@style/Base.TextAppearance.AppCompat.Title">    <item name="android:textSize">20sp</item></style>

like that...


You can add a TextView to your toolbar and customize as you want:

<android.support.v7.widget.Toolbar    android:id="@+id/toolbar"    android:layout_height="wrap_content"    android:layout_width="match_parent">    <TextView        android:id="@+id/toolbar_title"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/app_name"        android:textSize="25sp"/></android.support.v7.widget.Toolbar>