Android之在string.xml配置文字颜色粗体等效果

string.xml

<string name="exchange_txt_hint"><Data><![CDATA[请使用<font color="#ff0000"><b>%1$s</b></font>牛兑换<font color="#ff0000"><b>%2$s</b></font>%3$s 上网时长]]></Data></string>

 

java文件中置入对应%1$s的参数方法:一共有3个参数 String.valueOf(wifiCardType.needCoin)     wifiCardType.timeNumber    "小时 " + curClickedProviderSSID 

String exchange = getString(R.string.exchange_txt_hint,String.valueOf(wifiCardType.needCoin), wifiCardType.timeNumber, "小时 " + curClickedProviderSSID);

exchange_txtView.setText(Html.fromHtml(exchange));

 

你可能感兴趣的:(android)