Closed bobskycn closed 2 months ago
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) }
由于本项目参与者的技术及精力有限无法满足大部分开发者的需求, 欢迎开发者参与贡献
onCreateViewHolder可以覆写不就足够了吗?
onCreateViewHolder
给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) }
是否可以参与实现