android TextView设置中文字体加粗

英文设置加粗可以在xml里面设置:
android:textStyle="bold"

英文还可以直接在String文件里面直接这样填写:

<string name="styled_text">Plain, <b>bold</b>, <i>italic</i>, <b><i>bold-italic</i></b></string>
b代码加粗,i代表倾斜

文设置加粗就需要在代码中获取到当前TextView在进行设置:

TextView tv = (TextView)findViewById(R.id.tv); 
        TextPaint tp = tv.getPaint(); 
        tp.setFakeBoldText(true);


你可能感兴趣的:(android TextView设置中文字体加粗)