Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecyclerView inside ScrollView is not working smoothly if use picasso #1626

Open
ghost opened this issue May 22, 2017 · 9 comments
Open

RecyclerView inside ScrollView is not working smoothly if use picasso #1626

ghost opened this issue May 22, 2017 · 9 comments

Comments

@ghost
Copy link

ghost commented May 22, 2017

  1. <android.support.v4.widget.NestedScrollView

  2. <android.support.v7.widget.RecyclerView

  3. 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);
}
/

@NightlyNexus
Copy link
Contributor

I don't see how Picasso could make a RecyclerView stutter.
Can you make a minimum working sample project and link it here?

@ghost
Copy link
Author

ghost commented May 23, 2017

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();
                    }
                });
            }

@NightlyNexus
Copy link
Contributor

NightlyNexus commented May 23, 2017

and if you just remove this block,

Picasso.with(context)...{
...
});

there is no jank?

@Murtowski
Copy link

Murtowski commented Oct 25, 2017

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)

@ghost
Copy link

ghost commented May 12, 2018

Hi @peterphyo, Is this issue still open?

@ghost
Copy link
Author

ghost commented May 21, 2018

@MONIKA-KUMAR-JETHANI solve

@MeetMuzammil
Copy link

i am fetching image from drawable folder in recyclerview and i am using picasso library but my scrolling is not smootly.

@maulikdadhaniya
Copy link

check your image Size @MeetMuzammil

@gcmobilecodes
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants