码迷,mamicode.com
首页 > 其他好文 > 详细

One TextView More Style

时间:2014-06-27 15:13:07      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   java   tar   ext   

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);    

  

One TextView More Style,布布扣,bubuko.com

One TextView More Style

标签:style   class   blog   java   tar   ext   

原文地址:http://www.cnblogs.com/gfqFighting/p/3810308.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!