2018.12.17
tv_spinner.setOnClickListener {
selector("please choose the type",spannables){
i ->
tv_spinner.text = spannables[i]
val spanText = SpannableString(text)
spanText.setSpan(when (i){
0 -> RelativeSizeSpan(1.5f)
1 -> StyleSpan(Typeface.BOLD)
2 -> ForegroundColorSpan(Color.RED)
3 -> BackgroundColorSpan(Color.GREEN)
4 -> UnderlineSpan()
else -> ImageSpan(this@SpannableActivity, R.drawable.ic_launcher_foreground)
}, beginPos, endPos, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
tv_spannable.text = spanText
}
}