Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recyclerview点击时添加item选中样式时卡顿 #212

Open
ShshyDevooo opened this issue Mar 9, 2021 · 1 comment
Open

recyclerview点击时添加item选中样式时卡顿 #212

ShshyDevooo opened this issue Mar 9, 2021 · 1 comment

Comments

@ShshyDevooo
Copy link

大家是如何给recyclerview 的item点击时添加选中状态的,这边添加item选中状态会造成卡顿,严重掉帧。

@1046964106
Copy link

数据源实体Bean继承BaseObservable

定义变量,用liveData
@get:Bindable
var checked = MutableLiveData(false)

data class BeanModel():androidx.databinding.BaseObservable(){
@get:Bindable
var checked = MutableLiveData(false)
}

在改变选中状态的时候直接设置
xx.checked.postValue(true/false)
or
xx.value = true/false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants