liangjingkanji / BRV

[使用文档] Android 快速构建 RecyclerView, 比 BRVAH 更简单强大
http://liangjingkanji.github.io/BRV/
MIT License
2.59k stars 327 forks source link

给BindingAdaptor.onCreateViewHolder中的itemView初始赋值提供一个可以覆写的函数 #437

Closed bobskycn closed 2 months ago

bobskycn commented 5 months ago

给BindingAdaptor.onCreateViewHolder中的itemView初始赋值提供一个可以覆写的函数

有时候需要想提前把itemView加载,在onCreateViewHolder中直接调用,而不是在onCreateViewHolder函数中对itemView及时加载,从而减少加载时间。

open fun inflateView(parent: ViewGroup, viewType: Int):View{ return LayoutInflater.from(parent.context).inflate(viewType, parent, false) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BindingViewHolder { val itemView =inflateView(parent,viewType) }

是否可以参与实现

由于本项目参与者的技术及精力有限无法满足大部分开发者的需求, 欢迎开发者参与贡献

liangjingkanji commented 4 months ago

onCreateViewHolder可以覆写不就足够了吗?