我想通过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)