1.遇到的坑设置字体色彩偏差问题,原因是我在QMUITouchableSpan的构造函数中直接传了R.color.xx,
修改成使用ContextCompat.getColor(this,R.color.xx) 获取对象后再传进去问题解决
'''
var normalTextColor : Int = ContextCompat.getColor(this,R.color.xx)
var span : SpannableString = SpannableString(getString(R.string.agreement_hint))
span.setSpan(object : QMUITouchableSpan(normalTextColor,Color.RED,0,0){
override fun onSpanClick(widget: View?) {
//TODU
}
},startIndex,endIndex, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
span.setSpan(object : QMUITouchableSpan(normalTextColor,Color.RED,0,0){
override fun onSpanClick(widget: View?) {
//TODU
}
},startIndex,endIndex, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
text.setText(span)
text.setMovementMethodDefault()
'''
网友评论