首页 > 代码库 > One TextView More Style
One TextView More Style
String w = "The quick fox jumps over the lazy dog"; int start = w.indexOf(‘q‘); int end = w.indexOf(‘k‘) + 1; Spannable word = new SpannableString(w); word.setSpan(new AbsoluteSizeSpan(22), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); //字体大小 word.setSpan(new StyleSpan(Typeface.BOLD), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); //字体 word.setSpan(new BackgroundColorSpan(Color.RED), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); //背景 word.setSpan(new ForegroundColorSpan(Color.Blue), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); //字体颜色 word.setSpan(new StrikethroughSpan(), m.start(), m.end(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); //删除线 word.setSpan(new URLSpan(w), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);//下划线 textView.setText(word);
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。