Junaid Sakib
08/27/2020, 6:14 PMLayoutContainer
for ViewHolder
pattern still in experimental state, actually I am not finding much documentation around it, or maybe I am not looking in the right place?flosch
08/28/2020, 9:34 AMViewBinding
instead of kotlin-synthetics
flosch
08/28/2020, 9:35 AMViewBinding
you do not need to extend the ViewHolder
with anything:
Adapter
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): SomeViewHolder = SomeViewHolder(
ItemSomeBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
ViewHolder
internal class SomeViewHolder(
private val binding: ItemSomeBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(item: SomeItem) {
binding.textView.text = "${item.id}"
}
}
Junaid Sakib
08/29/2020, 1:44 PM