我有一个RecyclerView,每一行里面都有一个LinearLayout,根据每行的数据需要动态插入一些视图。
我已经尝试过
for(int i=0;i<4;i++){ View view = LayoutInflater.from(context).inflate(R.layout.sales_total_item_with_img,null); holder.dynamicLinearLayout.addView(view); }
the above code is written inside onBindHolder method and working but it is inflating each time I scroll and this thing is just adding more and more views
有人可以告诉我是否有做错什么并建议更好的方法吗?