zoukankan      html  css  js  c++  java
  • SpannableString用法注意

    正确的方法:

    使用AbsoluteSizeSpan时要每次都new一个新对象出来,如果定义好一个,连续使用,则只有最后一个生效。 前面使用的都回失去效果

    如下使用:

    SpannableString spanString = new SpannableString(sb.toString());

                

                spanString.setSpan(new AbsoluteSizeSpan(90), firstMarkStart, firstMarkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                spanString.setSpan(new ForegroundColorSpan(R.color.orange_color), firstMarkStart, firstMarkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                

                spanString.setSpan(new AbsoluteSizeSpan(90), secondMarkStart, secondMarkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                spanString.setSpan(new ForegroundColorSpan(R.color.orange_color), secondMarkStart, secondMarkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                

                this.timerLabel.setText(spanString);

  • 相关阅读:
    while循环
    No.四
    No. three
    第二章吧
    第二次写博客
    我人生的第一个程序,相当于哥伦布发现新大路。
    orale命令6 rman备份
    oracle 命令4 热备份
    oracle命令3 冷备份
    oracle命令2 和一致性关闭、非一致性关闭
  • 原文地址:https://www.cnblogs.com/feitianlee/p/4092267.html
Copyright © 2011-2022 走看看