android TextView sets the Chinese font bold implementation method
- 2020-05-07 20:26:27
- OfStack
English Settings bold can be set in xml:
In English, you can also fill in the String file like this:
The b code is bold, and i stands for skew
If the Chinese Settings are bold, you need to get the current TextView Settings in the code:
<SPAN style="FONT-SIZE: 18px">android:textStyle="bold"</SPAN>
In English, you can also fill in the String file like this:
<string name="styled_text">Plain, <b>bold</b>, <i>italic</i>, <b><i>bold-italic</i></b></string>
The b code is bold, and i stands for skew
If the Chinese Settings are bold, you need to get the current TextView Settings in the code:
TextView tv = (TextView)findViewById(R.id.tv);
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);