recycler_view.setNestedScrollingEnabled(false);
I am using a RecyclerView inside a ScrollView. Scrolling is working smoothly but it's not working smoothly when I use picasso.
/if (type.getPhotos() != null && type.getPhotos().size() > 0) {
Picasso.with(context).load("http://cap.com/uploads/photos/" + type.getPhotos().get(0).getPhoto()).into(holder.img);
}/
I don't see how Picasso could make a RecyclerView stutter.
Can you make a minimum working sample project and link it here?
Sorry for a large project, I can't separate it. Here is short code (main code) for not working smoothly. Thank You @NightlyNexus
xml
<RelativeLayout
<android.support.v4.widget.NestedScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_ways"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_types"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
Activity
recycler_view_ways = (RecyclerView) findViewById(R.id.recycler_view_ways);
recycler_view_ways.setLayoutManager(new GridLayoutManager(this, 2));
recycler_view_ways.setNestedScrollingEnabled(false);
WaysRVAdapter waysRVAdapter = new WaysRVAdapter(MainActivity.this, waysList);
recycler_view_ways.setAdapter(waysRVAdapter);
RVAdapter
if (type.getPhotos() != null && type.getPhotos().size() > 0){
holder.rotate_loading.start();
Picasso.with(context).load("http://cap.com/uploads/photos/" + type.getPhotos().get(0).getPhoto()).into(holder.img, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
holder.rotate_loading.stop();
}
@Override
public void onError() {
holder.rotate_loading.stop();
}
});
}
and if you just remove this block,
Picasso.with(context)...{
...
});
there is no jank?
Maybe your images are to big use "fit()"
Picasso.with(mContext)
.load(mUri)
.placeholder(R.drawable.ic_loading_animated)
.fit()
.centerCrop() // resizing images can really distort the aspect ratio, prevent this
.into(mImageView)
Hi @PeterPhyo, Is this issue still open?
@MONIKA-KUMAR-JETHANI solve
i am fetching image from drawable folder in recyclerview and i am using picasso library but my scrolling is not smootly.
check your image Size @MeetMuzammil
Maybe your images are to big use "fit()"
Picasso.with(mContext) .load(mUri) .placeholder(R.drawable.ic_loading_animated) .fit() .centerCrop() // resizing images can really distort the aspect ratio, prevent this .into(mImageView)
amazing its working perfect Thank you
Most helpful comment
Maybe your images are to big use "fit()"