语言:Kotlin
var search=" 你的整个item内容"
var start=search.indexOf("搜索框里的内容")
val builder = SpannableStringBuilder(search)
builder.setSpan(ForegroundColorSpan(Color.parseColor("#3073bf")), start, "搜索框里的内容".length+start, Spannable.SPAN_EXCLUSIVE_INCLUSIVE)//不管是哪一种都不会影响1跟3的颜色
helper.itemView.searchname.text=builder
网友评论