1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Drain Droids

Android Studio For Beginners.Mobile Apps.Android Games.

Monday, January 7, 2019

How to Bold A Section of text in A TextView in Android Studio




Really, as a beginner, you will always ponder how to get minor things done when you are working with android studio. Let say you want to bold a section of Text. This is different from Bolding the entire text which you can easy do with this code bellow

android:textStyle="bold" see image



So, including the code above in your TextView will bold the entire text in the TextView.

In this post, what we want to archive is how we can make a particular section of our text to be bold instead of the entire text.
You can achieve this doing the steps bellow



Step 1
In your XML you have something like this

android:text="@string/mypost" />

Step 2 head to string

<string name="mypost"> <b> Bold Me </b> don’t bold me </string>

Only the opening the closing html syntax will be bold