recyclerview viewholder example kotlin tutorial
Example 1: recyclerview dependency
implementation 'com.android.support:recyclerview-v7:23.1.1'
Example 2: recyclerview onCreateViewHolder kotlin
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val v: View = LayoutInflater.from(parent?.context)
.inflate(R.layout.custom_view, parent, false)
return ViewHolder(
v
)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder?.name?.text = list.get(position).description
}