Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the toolbar text size?

I want to change the size of text in Toolbar. Because in my application, Toolbar text has different sizes both for landscape and portrait mode.

Is it possible to change the text size of text in Toolbar?

like image 850
Apurva Avatar asked Feb 12 '15 20:02

Apurva


People also ask

How do I change the font size on my toolbar?

Typeface typeFace = Typeface. createFromAsset(getAssets(), "fonts/font_name. ttf"); Now, get the child item (toolbar title textview) from the existing toolbar, the default toolbar and pass the typeface object we created above.

How do I change the text title bar size in Android?

In method 1 Just go to the activity_main. xml file and add a TextView in the toolbar widget with the font-family attribute. The complete code for the activity_main. xml file is given below.

How do I increase the font size in Firefox toolbar?

You can click on Fonts and choose the font that you want. First click on the Settings on the top right of the firefox screen, it should look like a gear. Once you click on that, click on General, which should also looked like a gear on the left side of the firefox screen.


2 Answers

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

like image 176
Vukašin Manojlović Avatar answered Sep 28 '22 02:09

Vukašin Manojlović


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...

like image 45
massaimara98 Avatar answered Sep 28 '22 03:09

massaimara98