Giter VIP home page Giter VIP logo

Comments (14)

Priyanshi-Z avatar Priyanshi-Z commented on July 19, 2024 1

@miquelcopet
The solution which you have suggested is just a hack.Not a solution.Is there a proper way which doesn't decrease the performance of recycler view.

from views-widgets-samples.

himanshu-infield avatar himanshu-infield commented on July 19, 2024 1

any solution for this i am stuck in this problem and after adding holder.setIsRecyclable(false) my recyclyeview scroll lag

from views-widgets-samples.

malookshah4 avatar malookshah4 commented on July 19, 2024 1

I have same issue..

Im building chat layout like whatsap which has different views typs in recyclerview like video photos voice and msg views.
The problem is that when i scroll up and down some time the picture message view decreasing there size and some time voice msg decreasing there size and changing color..

Is there anyone to help me.

from views-widgets-samples.

miquelcopet avatar miquelcopet commented on July 19, 2024

I'm having the same issue. Did you find any fix?

from views-widgets-samples.

miquelcopet avatar miquelcopet commented on July 19, 2024

Got it!
In onBindViewHolder you have to remove all the views from the container and then add the new view.

holder.viewGroup.removeAllViews();
holder.viewGroup.addView(view);

from views-widgets-samples.

Priyanshi-Z avatar Priyanshi-Z commented on July 19, 2024

Hi,
Is there a way to solve this problem without removing All views and without doing setIsRecyclable set to false. Like a solution which doesn't decrease the performance of our recycler view.And Can you explain why this problem generally occurs @techievbv @mangini

from views-widgets-samples.

samkazmi avatar samkazmi commented on July 19, 2024

I'm having the same issue. Anyone have a solution for this?

from views-widgets-samples.

Priyanshi-Z avatar Priyanshi-Z commented on July 19, 2024

I'm having the same issue. Anyone have a solution for this?
Try this..
https://medium.com/@polson55/smooth-recyclerview-scrolling-in-android-57e7a9b71ca7

from views-widgets-samples.

asad175 avatar asad175 commented on July 19, 2024

android:fitsSystemWindows="false" inside CoordinatorLayout will help. Here its explained how you can use a RecyclerView with Multiple View Types.

from views-widgets-samples.

BoumBam avatar BoumBam commented on July 19, 2024

I'm having the same issue. Anyone have a solution for this ?

from views-widgets-samples.

adarshsingh994 avatar adarshsingh994 commented on July 19, 2024

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:
Just like there is an onBind method available in adapter class, there is an onviewRecycled method too. This method tells when the previous view is getting recycled to be used by a different value. Use this method to do a view cleanup

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 :-)

from views-widgets-samples.

Gaawk avatar Gaawk commented on July 19, 2024

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?

from views-widgets-samples.

malookshah4 avatar malookshah4 commented on July 19, 2024

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

from views-widgets-samples.

fast050 avatar fast050 commented on July 19, 2024

Hi,
maybe your problem is that the layout :

  • is nested and you try to fill a lot of data in the XML.
  • using data binding and use custom data binding.

from views-widgets-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.