Goofy Goofy -4 years ago 149
Android Question

Programmatically set the Typeface and set text style in xml not working

I have a textview defined in xml, now i am setting the Typeface programmatically like this:

textView.setTypeface(APP_FONT_REGULAR); // which is custom font in assests (.ttf file).


now i have set
android:textStyle="bold"
in xml

but it's not applying bold?

what is the reason i need to apply my own Typface and set it to bold also.

Answer Source

i need to apply my own Typface and set it to bold also.

You can set appearance when you call setTypeface() like this

textView.setTypeface(APP_FONT_REGULAR, Typeface.BOLD);

it solve your problem. Check it out.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download