Android - Setting TextView to Bold Not Working

前端 未结 10 1678
悲哀的现实
悲哀的现实 2020-12-17 08:43

Here is the XML:



        
相关标签:
10条回答
  • 2020-12-17 09:02

    The reason TextView not changes to bold when you run your application on mobile device is that you must have used Calligraphy in your activity. So, to change the style to bold all you have to do is write the following code in your java file.

     textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
    

    Good Luck

    0 讨论(0)
  • 2020-12-17 09:04

    Could you please post all of your java and xml codes for us to gather more information about your issue?

    It is possible that the issue is not in the TextView you are showing us but so far the

    android:textStyle="bold"
    

    seems to work on your graphical layout.

    0 讨论(0)
  • 2020-12-17 09:06

    Well, I found a silly answer to this problem. I was using a custom font on the device, not the default one. Once I switched to the default one, every things worked as expected!

    0 讨论(0)
  • 2020-12-17 09:10

    Create custom theme for or all device layout. and set into your textview.

    I think problem is text will be very slow so you can get any effect.

    If you have test this issue then change font size up to 40sp and run what happen?

    0 讨论(0)
提交回复
热议问题