小编Cuo*_*Huy的帖子

如何通过使用getString()设置粗体文本

我想通过setText()显示粗体文本,但是我只是看到文本不是粗体:(我该如何解决这个问题?

这是我的代码:String.xml:

<string name="country"><b>AMERICA-default</b></string>
Run Code Online (Sandbox Code Playgroud)

我的Java代码:

Resources resources;
TextView tvCountry;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    Log.d("test","onCreate()-second Activity");
    setContentView(R.layout.activity_second);

    resources = getResources();
    tvCountry = (TextView) findViewById(R.id.tvCountry);
    tvCountry.setText(resources.getString(R.string.country));//its not working !Text is not bold!
    //CANNOT USE : tvCountry.setText(R.string.country);
}
Run Code Online (Sandbox Code Playgroud)

android getstring textview settext

0
推荐指数
1
解决办法
1085
查看次数

标签 统计

android ×1

getstring ×1

settext ×1

textview ×1