问题:
如果在xml里面设置了 textStyle="bold"属性,实现中文和英文的粗体效果。但是代码中如何取消文字粗体效果?
解决办法:
TextView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
注意:上面的“TextView” 要替换为你自己的对象
无法实现的反例:
1、
TextPaint tp = textView .getPaint();
tp.setFakeBoldText(true);
2、
textview.setTypeface(textview.getTypeface(), Typeface.BOLD);
以上 1、2 两个方法都无法实现