Recyclerview painfully slow to load cached images form Picasso
Setting recyclerView parameters as below solved my stutter problem :
recyclerView.setHasFixedSize(true);recyclerView.setItemViewCacheSize(20);recyclerView.setDrawingCacheEnabled(true);recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
i hope it helps someone else too.
Use fit()
.
Picasso.with(context) .load(file) .fit() .centerCrop() .into(imageView);
The fit()
actually resizes the image to fit into the imageView
's bounds. This doesn't load the full image and smoothens the scrolling.
I mixed the answer from @ergunkocak and @Mangesh Ghotage, using this works great:
recyclerView.setHasFixedSize(true);recyclerView.setItemViewCacheSize(20);recyclerView.setDrawingCacheEnabled(true);
And this on every image:
Picasso.with(context) .load(file) .fit() .into(imageView);
besides you could set Picasso to use a single instance like this:
Picasso.setSingletonInstance(picasso);
And finally enabling the cache indicators will give you clues on what's going wrong:
Picasso .with(context) .setIndicatorsEnabled(true);