Hi,
i follow some tutorials here.
But what i missing is the hint, how can i properly highlight a selected item on RecyclerView?
I handle the cllick event, but how can i set or change for example the background color
here is my snippet for the viewholder:
inner class ViewHolder(val binding: NewArticleCategoryItemRowBinding) : RecyclerView.ViewHolder(binding.root),
View.OnClickListener {
init {
binding.root.setOnClickListener(this)
}
fun bind(item: ArticleCategory) {
binding.viewmodel = NewArticleCategoryItemViewModel(item)
binding.executePendingBindings()
}
/**
* List click
*/
override fun onClick(view: View) {
selectedCategoryItem = items[position]
}
}
Thanks for any help or hints