Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change text to bold in Android?

How do you change text/font settings in an Android TextView?

For example, how do you make the text bold?

like image 968
nithin Avatar asked Jan 25 '11 10:01

nithin


1 Answers

To do this in the layout.xml file:

android:textStyle 

Examples:

android:textStyle="bold|italic" 

Programmatically the method is:

setTypeface(Typeface tf) 

Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use setTypeface(Typeface, int) to get the appearance that you actually want.

like image 162
Phobos Avatar answered Oct 11 '22 22:10

Phobos