How to make Text in TextView bold and italic in Android

To make text in your TextView Bold or Italic in Android Programming we need to make use of attribute android:textAppearance. It can have three values normal, bold and Italic.

Android TextView Bold and Italic.png
Android TextView Bold and Italic.png

Example 1 : Bold

<TextView
  android:id="@+id/tvBold"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="This line is in Bold"
  android:textAppearance="?android:attr/textAppearanceLarge"
  android:textStyle="bold" />

Example 2 : Italic

<TextView
  android:id="@+id/tvItalic"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="This line is in Italic"
  android:textAppearance="?android:attr/textAppearanceLarge"
  android:textStyle="italic" />

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!