第一种方法:
//设置两种字体大小Spannable WordtoSpan = new SpannableString(codeMemoTV.getText().toString());WordtoSpan.setSpan(new AbsoluteSizeSpan((int) DimensionUtil.convertDpToPixel(18, this)), 0, 8, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);codeMemoTV.setText(WordtoSpan);//设置两种字体颜色和大小Spannable WordtoSpan1 = new SpannableString("好友成交额6255.50元");WordtoSpan1.setSpan(new AbsoluteSizeSpan((int) DimensionUtil.convertDpToPixel(18, this)), 5, 8, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);WordtoSpan1.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.black)), 5, 8, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);codeMemoTV.setText(WordtoSpan1);或者:
msgTV.setText(Html.fromHtml(String.format("%s出价 <font color=\&;#f06c55\&;>%.0f</font>元", item.getIsPerPrice() , item.getBidPrice())));效果图:
,在乎的是看风景的心情,旅行不会因为美丽的风景终止。