Wednesday, April 6, 2016

Android - How to set TextView text style

We can set text style by the setTypeface of TextView class.

Below is text style type.
(1) Bold + Italic : Typeface.BOLD_ITALIC
(2) Bold : Typeface.BOLD
(3) Italic : Typeface.ITALIC
(4) Normal : Typeface.NORMAL

Sample Code
 TextView textView = (TextView)this.findViewById(R.id.text_view);
 textView.setTypeface(null, Typeface.BOLD_ITALIC);
 textView.setTypeface(null, Typeface.BOLD);
 textView.setTypeface(null, Typeface.ITALIC);
 textView.setTypeface(null, Typeface.NORMAL);

No comments:

Post a Comment