-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling recyclerView with multiple view types causing strange overlapping of views #18
Comments
I'm having the same issue. Did you find any fix? |
Got it!
|
Hi, |
@miquelcopet |
I'm having the same issue. Anyone have a solution for this? |
|
any solution for this i am stuck in this problem and after adding holder.setIsRecyclable(false) my recyclyeview scroll lag |
android:fitsSystemWindows="false" inside CoordinatorLayout will help. Here its explained how you can use a RecyclerView with Multiple View Types. |
I'm having the same issue. Anyone have a solution for this ? |
The fix is simple!! Let me explain, as you know recycler view recycles the views and does not create a new view unless needed. Since its recycling the previously created views its reusing the components inside it. So when the recycled view is reused, the layout is the same one to with it was binded before binding it with the new data. Now when you scroll normally the view gets replaced by the new view quickly and hence you do not notice it, but when you scroll fast the view is visible even before it gets binded. Got It? Fix: Example: If in onBind() you are setting an image in ImageView using Glide.with(context).load(uri).into(imageView) then in onViewCleared() you can call Glide.with(context).clear(imageView). This will clear the image view before onBind is called hence you won't see the previous image if you scroll fast. Hope it helps :-) |
I have same issue.. Im building chat layout like whatsap which has different views typs in recyclerview like video photos voice and msg views. Is there anyone to help me. |
Is this fixed for anyone? I'm building a chat app. Adapter works fine for me when in getItemViewType(), I return position but adding a new item to the list creates problem in this case. And if I return different two different viewTypes from getItemViewType(), adding new item works fine but list gets stuck in loop when i scroll. Anyone found any solution? |
use delegated Recyclerview adopter |
Hi,
|
Hi,
The scenario I have is a recycler view containing items with different view types, i.e. i audio, video, image files all in a single adapter, in order to show media files as in other gallery apps.
Now, coming at the issue:
Whenever there are huge number of files present inside the recycler view, and I scroll through the items very fast (top-to-down and vice versa), some of the video thumbnails(of the video files) get overlapped over the audio files placeholder. Again, this happens only when the number of files is large and when scrolled quickly.
Just an FYI:
The getItemViewType() is returning the type of item in order to set appropriate views(for audio, video ,image).
Can anyone confirm if they have experienced a similar issue in the past ?
Or, any idea why this might be happening ?
The text was updated successfully, but these errors were encountered: