I am using RecyclerView
with GridLayoutManager
and The speed of RecyclerView Scroll
is too much. I want it to slow down. I did try many other codes and approaches but, none worked for me.
Here is what I found
This post suggests that In onCreateViewHolder
and onBindViewHolder
there shouldn't be I/O operations and taking too much time to execute any of these method creates a lag. But, I have no I/O operations and not much code into these.
...
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.single_view, parent, false);
return new MyViewHolder(view,listner);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
GlideApp.with(context)
.load(arrayList.get(position).getUri())
.apply(RequestOptoins.overrideOf(180,180))
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(holder.img);
Log.d("FetchImages(): "," Glide Called");
}
...
This post suggests to use a CustomLayoutManager
Class. But, this didn't work for me either. May be because all answers are focused on LinearLayoutManager
and may be it doesn't suupport GridLayoutManager
.
I tried this link as well but, I can't understan what's going in there.
4.https://programmer.group/android-recycler-view-slides-quickly-to-the-top.html
Same with this link. Can't understand a thing.
List is too long to post here. But, Ultimately I tried everything and everycode I understood. But, so far nothing seems to work for me.
Note I am trying to show images from external storage. So, on first load glide will create thumbnails to cache and then on second load there will no larger size images. But, still there are more than 5000 images in my phone. And at a time recyclerview can show 40 images only. So, if I accidently scroll fast rest of the images will load in forground. So, I want to disable that fast scrolling so no matter how many photos are there recyclerview will only show loaded photos.