This is more like a generic question, but after lot of search and try I am not able to understand why this is so difficult to achieve. This is the closest answer I can find but still unable to implement.
To be specific I am using RecyclerView with GridLayoutManager. All I want is the grid layout to scroll smoothly (like default gallary app) ,nothing fancy, but the default implementation of grid layout manager scrolls the view in a 'jerky' manner. I tried to implement the method from above link but unsuccessfully.
I also tried to implement LinearSmoothScroller but I am not sure how to implement computeScrollVectorForPosition method. Google's documentation on computeScrollVectorForPosition literally has 0 words.
I found this 3 part tutorial, but it was of very little help. So, all I want to ask is: can there be some kind of template code which we can implement in LinearSmoothScroller or by extending RecyclerView.SmoothScroller and achieve smooth scrolling ? Even if the code depends on number of items and items per row in gridlayout, there has to be some method to do it easily. Am I missing something here ?
StrictMode
, and so on. – BoulevardierRecyclerView
, this would mean taking too much time inonBindViewHolder()
or possibly inonCreateViewHolder()
. Those each need to return in sub-millisecond times, meaning you cannot do disk I/O or network I/O in them. – Boulevardierholder.photo.setImageBitmap(BitmapFactory.decodeFile(itemList.get(position).getAbsolutePath()));
on onBindViewHolder() and the image file is around 100kb each with about a dozen images in the list. I will try to do a better implementation of it. – Duumvirate