Is the `LayoutContainer` for `ViewHolder` pattern ...
# android
j
Is the
LayoutContainer
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?
f
This will also stay in experimental state, since it is recommended to use
ViewBinding
instead of
kotlin-synthetics
With
ViewBinding
you do not need to extend the
ViewHolder
with anything: Adapter
Copy code
override fun onCreateViewHolder(
    parent: ViewGroup,
    viewType: Int
): SomeViewHolder = SomeViewHolder(
    ItemSomeBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
ViewHolder
Copy code
internal class SomeViewHolder(
    private val binding: ItemSomeBinding
) : RecyclerView.ViewHolder(binding.root) {

    fun bind(item: SomeItem) {
        binding.textView.text = "${item.id}"
    }
}
j
Thanks Florian, actually my use case was based on: https://github.com/Liverm0r/DelegateAdapters, however I feel - I might as well convert this into a view binding holder.