I have one recycler view and inside each row I have one linear layout in which I have to insert some views dynamically according to data on each row.
I have tried
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
Can anyone tell me if I am doing anything wrong and suggest me the better approach?
try holder.dynamicLinearLayout.removeAllViews() before for loop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With