安卓TextView显示不同的字体

String str1 = "Invite <font color='#fffc01'><b>" + remindTimes + "</b> </font>Friends to try your first 2P mode!";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N && mTitle != null) {
    mTitle.setText(Html.fromHtml(str1, Html.FROM_HTML_MODE_LEGACY));
} else if (mTitle != null) {
    mTitle.setText(Html.fromHtml(str1));
}

猜你喜欢

转载自blog.csdn.net/jason_hd/article/details/80801070