admin 管理员组

文章数量: 887007

取消文本粗体效果

 SpannableString spannableString = new SpannableString(textView.getText());spannableString.setSpan(new StyleSpan(Typeface.BOLD),0, 3, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);

给textView设置字体加粗,想要设置成默认样式下面代码不起作用,怎么办

SpannableString spannableString = new SpannableString(textView.getText());spannableString.setSpan(new StyleSpan(Typeface.NORMAL),0, 3, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);

removeSpan

StyleSpan[] spans = spannableString.getSpans(0, 3, StyleSpan.class);for (StyleSpan span : spans) {spannableString.removeSpan(span);}
textView.setText(spannableString);

本文标签: 取消文本粗体效果