php中文网 | cnphp.com

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
搜索资源  
php中文网 | cnphp.com 资源中心 源码 web开发 Adapter class for Recyclerview in kotlin android: Adapter class for Recyclerview in kotlin android.txt

Adapter class for Recyclerview in kotlin android: Adapter class for Recyclerview in kotlin android.txt

 

Adapter class for Recyclerview in kotlin android:
[mw_shl_code=applescript,true]class ClassName(val list:ArrayList<Type of your list>):RecyclerView.Adapter<ClassName.ViewHolder>() {


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ClassName.ViewHolder {
        val v = LayoutInflater.from(parent.context).inflate(R.layout.item_layout, parent, false)
        return ViewHolder(v)
    }

    override fun getItemCount(): Int {
       return list.size
    }

    override fun onBindViewHolder(holder: ClassName.ViewHolder, position: Int) {
        holder.bindItems(list[position])
    }
    class ViewHolder(itemview: View):RecyclerView.ViewHolder(itemview)
    {

        fun bindItems(t: type of your list){

        }
    }
}[/mw_shl_code]

QQ|php中文网 | cnphp.com ( 赣ICP备2021002321号-2 )

GMT+8, 2024-5-10 04:06 , Processed in 0.164409 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

申明:本站所有资源皆搜集自网络,相关版权归版权持有人所有,如有侵权,请电邮(fiorkn@foxmail.com)告之,本站会尽快删除。

返回顶部