basequickadapter详解_在kotlin中如何使用BaseQuickAdapter适配器
為了更好的進(jìn)行理解先來(lái)對(duì)比下
Java代碼
public class WithdrawRecordAdapter2 extends BaseQuickAdapter {
public WithdrawRecordAdapter2(int layoutResId, @Nullable List data) { super(layoutResId, data); }
@Override protected void convert(BaseViewHolder helper, TestWithdrawalRecordBena item) {
TextView status = helper.getView(R.id.withdraw_state); helper.setText(R.id.withdraw_number, "-¥" + item.getMoney()).setText(R.id.withdraw_date, item.getDate()); if (item.getState() == 1) { status.setText("提現(xiàn)中"); status.setTextColor(Color.parseColor("#1A66FF")); } else if (item.getState() == 0) { status.setText("已提現(xiàn)"); status.setTextColor(Color.parseColor("#3DC637")); } else if (item.getState() == -1) { status.setText("未通過(guò)"); status.setTextColor(Color.parseColor("#FF661A")); } } }
Kotlin代碼
class WithdrawRecordAdapter2(layoutResId: Int, data: List?) : BaseQuickAdapter(layoutResId, data) {
override fun convert(helper: BaseViewHolder, item: TestWithdrawalRecordBena) {
val status = helper.getView(R.id.withdraw_state) helper.setText(R.id.withdraw_number, "-¥" + item.money).setText(R.id.withdraw_date, item.date)
if (item.state == 1) {
status.text = "提現(xiàn)中"
status.setTextColor(Color.parseColor("#1A66FF"))
} else if (item.state == 0) {
status.text = "已提現(xiàn)"
status.setTextColor(Color.parseColor("#3DC637"))
} else if (item.state == -1) {
status.text = "未通過(guò)"
status.setTextColor(Color.parseColor("#FF661A")) }
}
}
總結(jié)
以上是生活随笔為你收集整理的basequickadapter详解_在kotlin中如何使用BaseQuickAdapter适配器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
 
                            
                        - 上一篇: 固定电话打长途多少钱一分钟
- 下一篇: 中考化学原理题与科学探究解题时需注意哪些
