how to have bold and normal text in same textview in android?

前端 未结 7 1214
终归单人心
终归单人心 2021-02-18 23:48

I have searched internet and tried the following code but its not working

SpannableString ss1 = new SpannableString(\"Health: \");
           ss1.setSpan(new and         


        
7条回答
  •  佛祖请我去吃肉
    2021-02-19 00:25

    I would use a string resource such as this:

    Health: %1$s
    

    When you want to set the health status just use this code:

    String ss1 = getString(R.string.health_status, strhealth);
    

提交回复
热议问题