在onCreateViewHolder 时候不要使用
inflater.from(context).inflate(R.layout.item,null)
而应该用
inflate.from(context).inflate(R.layout.item,parent,false)
本文介绍了一个在使用RecyclerView时的重要优化技巧:在onCreateViewHolder方法中正确使用LayoutInflater,避免了潜在的性能问题。
在onCreateViewHolder 时候不要使用
inflater.from(context).inflate(R.layout.item,null)
而应该用
inflate.from(context).inflate(R.layout.item,parent,false)
1090
1487