Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textview: adjust font size to match parent [duplicate]

Is it possible to set font size to automatically match_parent?

My TextView is already width/height="match_parent" but the font size is small and doesn't fit to the parent size.

How to do that?

like image 708
AngryOliver Avatar asked Jul 08 '14 14:07

AngryOliver


People also ask

What is autoSizeStepGranularity?

autoSizeMaxTextSize is the maximum size of textview it will take autoSizeMinTextSize is the minimum size of textview it will take and autoSizeStepGranularity is the size of each step.

How do I change font size in XML?

You can adjust the size in the Text Size submenu of the View menu or by pressing Ctrl+I (increase font size), Ctrl+D (decrease font size) and Ctrl+0 (normal font size).

Which attribute increases or decreases the font size of TextView select one?

android:textSize specifies the font size.


1 Answers

android:autoSizeTextType="uniform"

add this line to your TextView

Edit: this line will work for api 26 and higher so if you want to use it for api lower than 26 use this

app:autoSizeTextType="uniform"

if adding this line gives you error ignore the error by adding

tools:ignore="MissingPrefix"
like image 60
Younes Avatar answered Sep 23 '22 16:09

Younes