首页 > 代码库 > 同一TextView不同文字大小

同一TextView不同文字大小

 1         /**
 2          * 获取格式化的收益率
 3          *
 4          * @return
 5          */
 6         public Spannable getFormattedGainsRate(String gainsRate) {
 7             Spannable wordToSpan = new SpannableString(gainsRate);
 8             wordToSpan.setSpan(new AbsoluteSizeSpan(18, true), 0, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 9             wordToSpan.setSpan(new AbsoluteSizeSpan(15, true), 2, gainsRate.length(), Spannable
10                     .SPAN_EXCLUSIVE_EXCLUSIVE);
11             return wordToSpan;
12         }

 

同一TextView不同文字大小