If you add an item after removing it from RecyclerView, the onCreateViewHolder function cannot be executed, so please help.

Asked 2 years ago, Updated 2 years ago, 94 views

In the image view with size MATCH_PARENT and vertical WRAP_CONTENT, If you add an image and delete it and add it again, the item is set to the size of the previous image. Is there a solution?

RecyclerView with three images, such as -> Add and remove two smaller images.

It looks like the screen above.

I think I can recreate the View Holder The previously created ViewHolder is not being recreated, is there any way to create a new one?

android recyclerview

2022-09-22 15:54

1 Answers

In the part where you delete an item, recyclerView.removeViewAt(position); I solved it by writing it.

This function creates a new view holder.


2022-09-22 15:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.