Android开发字符串拼接,变色
一般在勾选隐私政策,会员协议
一、效果图:
二、关键代码:
TvUtils.create()
.addSsbColorClick("aaa", mContext.getColors(R.color.transparent)){
setIsAgree()
}
.addSsbColorClick(getString(R.string.vip_auto_renewal_9), mContext.getColors(R.color.black)){
setIsAgree()
}
.addSsbColorClick(
getString(R.string.vip_auto_renewal_7),
mContext.getColors(if(type == 0) R.color.c_main else R.color.c_DD9B47)
) {
if(!serviceUrl.isNullOrEmpty()){
IntentUtils.startWebActivity(mContext,serviceUrl,getString(R.string.vip_auto_renewal_8))
}
}
.addSsbColorClick(if (payType == 2){
getString(R.string.vip_auto_renewal_6)
} else {
""
}, mContext.getColors(R.color.black)){
setIsAgree()
}
.addSsbColorClick( if (payType == 2){
getString(R.string.vip_auto_renewal_2)
} else {
""
}, mContext.getColors(if(type == 0) R.color.c_main else R.color.c_DD9B47)
) {
if(!autoRenewUrl.isNullOrEmpty() && payType == 2){
IntentUtils.startWebActivity(mContext,autoRenewUrl,getString(R.string.vip_auto_renewal_3))
}
}
.showIn(tvAgreement)
有需要完整源码的私信我,我每天都看私信的