How to make RelativeSizeSpan align to top

后端 未结 9 2016
情深已故
情深已故 2021-01-31 03:14

I have the following String RM123.456. I would like to

  • Make RM relatively smaller
  • Make RM aligned to to
9条回答
  •  攒了一身酷
    2021-01-31 03:39

    I know this is an old thread, but I just came across this today, and I'm surprised no one answered with this... I'd recommend not hardcoding the 2, 4 but you can figure out how to

    val span = SpannableStringBuilder.valueOf("$temp")
    span.append("°F", SuperscriptSpan(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
    span.setSpan(RelativeSizeSpan(0.5f), 2, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
    tempTextView.setText(span, TextView.BufferType.SPANNABLE)
    

提交回复
热议问题