Closed ozy1996 closed 1 year ago
protected abstract fun onBindViewHolder(holder: VH, position: Int, item: T?) 能否改成 protected abstract fun onBindViewHolder(holder: VH, position: Int, item: T),
像3.0版本那样protected abstract fun convert(holder: VH, item: T) 感觉没有必要设置可为空吧,要是真的有空值的话,在泛型中定义为空就好了吧,是在什么场景下会为null呢?
//这里定义String?可为null就好了吧~ class TestAdapter:BaseQuickAdapter<String?,QuickViewHolder>() { override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: String?) { } override fun onCreateViewHolder( context: Context, parent: ViewGroup, viewType: Int ): QuickViewHolder { return QuickViewHolder(R.layout.listitem_title,parent) } }
pos数组越界的情况下,可能为null
长时间未回复,问题先关闭了
protected abstract fun onBindViewHolder(holder: VH, position: Int, item: T?) 能否改成 protected abstract fun onBindViewHolder(holder: VH, position: Int, item: T),
像3.0版本那样protected abstract fun convert(holder: VH, item: T) 感觉没有必要设置可为空吧,要是真的有空值的话,在泛型中定义为空就好了吧,是在什么场景下会为null呢?