金额小数点后面和前面字体大小不一致的实现

金额小数点后面和前面字体大小不一致的实现_第1张图片

核心代码:


 SpannableStringBuilder builder = new SpannableStringBuilder(amount);
        builder.setSpan(new AbsoluteSizeSpan(UIUtils.sp2px(12)), amount.indexOf("¥"), amount.indexOf("¥") + 1
, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.setSpan(new AbsoluteSizeSpan(UIUtils.sp2px(12)), amount.indexOf("."), amount.length()
, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        activityRef.get().mBinding.allPrice.setText(builder);





你可能感兴趣的:(Android)