Amira Elsayed Ismail
Amira Elsayed Ismail

Reputation: 9414

Bold Style not applied to textview android

I'm using action bar with custom view for title to be able to add Title and Subtitle

I need to set Title Style to Bold, When I make it in the XML layout it works fine, but I need to set it from code using

textView.setTypeface(null, Typeface.BOLD);

but it does not work, can anyone please help

Upvotes: 0

Views: 1669

Answers (2)

Ahmed Faisal
Ahmed Faisal

Reputation: 4427

Ideally it should work. This may sound mundane but can you check if it gets reset somewhere after you set it to bold the first time in your Java file.

Upvotes: 1

NaviRamyle
NaviRamyle

Reputation: 4007

You can use this code to display HTML codes in textviews

textView.setText(Html.fromHtml("<b>BOLD WORDS HERE</b>"));

Upvotes: 0

Related Questions