In this tutorial, you will learn how to make Android TextView bold. There are 4 ways in this tutorial, you can easily learn, adapt the code and use it in your project as you like. Let’s start.



Way 1 – make Android TextView bold using android:textStyle attribute

android:textStyle attribute is the first and one of the best way to make the text in TextView bold. just use “bold”.

If you want to use bold and italic. Use pipeline symbol “|” . just like this “bold|italic”.

Way 2 – make Android TextView bold using setTypeface() method

TextView has a method called setTypeface() which needs

  1. Typeface
  2. Int styleflag

In our case, leave Typeface as null, use styleflag Typeface.BOLD.


You can use Typeface.ITALIC for italic style.

Way 3 – make Android TextView bold using Html.fromHtml() method

The fromHtml() method returns displayable styled text from given Html string. Using this advantage, we can make our text in TextView bold.


Html.fromHtml(String source) was deprecated in API level 24. Use androidx.core.text.HtmlCompat instead. For using HtmlCompat, you need to include dependency in your project.

If you got Manifest merger failed error, then add below code in gradle.properties.

HtmlCompat.FROM_HTML_MODE_LEGACY – It just adds two newline character between block level elements.

Way 4 – Make Android TextView Bold using separate style

In this example, we create a separate style resource and set it to our TextView. The advantage of this technique – you can use this style for many TextViews. Just specifying style attribute.

Step 1

Create a separate style resource named “boldStyle”, add “android:textStyle” as item and provide value “bold”.

Step 2

Set style to TextView using style attribute.


Let’s create Android app with these examples. Open your Android Studio,

Step 1

Start a new Android Studio project

Application name: TextView Bold – Kotlin

Company domain: androidride.example.com

check to include Kotlin support.


Step 2

Select minimum SDK: API 15 – Android 4.0.3 (Ice Cream Sandwich) and click Next.

Next dialog, Select Empty Activity and click Next.

Activity Name: MainActivity
Check Generate layout file

Layout Name: activity_main

Click Finish.


build.gradle(Project: TextView Bold – Kotlin)

build.gradle(Module: app)

gradle.properties

colors.xml

strings.xml

styles.xml

activity_main.xml

MainActivity.kt

Run Now

android textview bold example - android set text bold
android textview bold

If you find anything useful, please share it.
Thank you.