Skip to content Skip to sidebar Skip to footer

Textview Isbold Always Returns Normal

I am setting Typeface of a textview like this textView.setTypeface(tf_roboto_medium, Typeface.BOLD); When I check the style using this command, it is evaluated true. if (textView.

Solution 1:

Try one of these this:

  1. if (textView.getTypeface().isBold()) {
  2. if ((textView.getTypeface().getStyle() & Typeface.BOLD) > 0) {

From what I see there is a bit mask used for font styles. Normal == 0 so there can be problems with 0 & 0

Solution 2:

You can do a string:

<stringname="train"><b>Train</b></string>

And then set:

android:text="@string/train"

Post a Comment for "Textview Isbold Always Returns Normal"