android TextView 不止支持 HTML,也支持部分文字样式和部分点击事件
SpannableString sb = new SpannableString("hello world");
sb.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
Toast.makeText(getApplicationContext(), "click", Toast.LENGTH_SHORT).show();
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(false);
// ds.setColor(Color.GRAY);
}
}, 5, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(sb);
textView.setMovementMethod(LinkMovementMethod.getInstance());