Bold words in a string of strings.xml in Android

前端 未结 9 2120
甜味超标
甜味超标 2020-12-01 02:44

I have a long text in one of the strings at strings.xml. I want to make bold and change the color of some words in that text.

How can I do it?

9条回答
  •  囚心锁ツ
    2020-12-01 03:12

    strings.xml

    This price is %1$s USD
    

    page.java

    String successMessage = getText(R.string.message,"5.21");
    

    This price 5.21 USD

提交回复
热议问题