|
@@ -1,6 +1,10 @@
|
|
|
package com.yingyang.healthconsultation.adapter
|
|
|
|
|
|
+import android.graphics.Color
|
|
|
import android.text.Html
|
|
|
+import android.text.SpannableString
|
|
|
+import android.text.Spanned
|
|
|
+import android.text.style.ForegroundColorSpan
|
|
|
import com.yingyang.healthconsultation.R
|
|
|
import com.yingyang.healthconsultation.databinding.ItemRecommendDoctorBinding
|
|
|
import com.yingyang.healthconsultation.entity.ConsultationBean
|
|
@@ -17,10 +21,20 @@ class RecommendDoctorAdapter(override val layoutId: Int = R.layout.item_recommen
|
|
|
position: Int
|
|
|
) {
|
|
|
binding.data = item
|
|
|
- val price = "单次:¥<font color='#FF4A76FF'>¥" + item.price + "</font>"
|
|
|
- binding.tvPrice.setText(Html.fromHtml(price))
|
|
|
+ val price = "单次:¥" + item.price
|
|
|
+ val priceSpannableString = SpannableString(price)
|
|
|
+ priceSpannableString.setSpan(
|
|
|
+ ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
|
|
|
+ 3, priceSpannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
+ )
|
|
|
+ binding.tvPrice.text = priceSpannableString
|
|
|
|
|
|
- val consultationTotal = "咨询量:<font color='#FF4A76FF'>" + item.consultationTotal + "</font>"
|
|
|
- binding.tvConsult.setText(Html.fromHtml(consultationTotal))
|
|
|
+ val consultationTotal = "咨询量:" + item.consultationTotal
|
|
|
+ val spannableString = SpannableString(consultationTotal)
|
|
|
+ spannableString.setSpan(
|
|
|
+ ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
|
|
|
+ 3, spannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
+ )
|
|
|
+ binding.tvConsult.text = spannableString
|
|
|
}
|
|
|
}
|