0

Hey I am using recyclerview with list-card design and on every card I have an image, not a large one it weights 1.5 mb I am loading 12 cards but the scrolling is so laggy I tried using PICASSO and it didn't helped, the thing is when I replace the image with a much smaller one (300 bytes) it scrolles well but it doesn't solve my problem..

the relevant part of the cards xml is:

 <android.support.v7.widget.CardView android:id="@+id/card_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" card_view:cardCornerRadius="4dp"> <RelativeLayout android:id="@+id/cont_card_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true" android:background="#FFFFFF"> <ImageView android:id="@+id/im_item_icon" android:layout_width="wrap_content" android:layout_height="170dp" android:scaleType="fitXY" android:layout_alignParentTop="true" android:layout_alignParentStart="true" /> 

as I was saying I tried using PICASSO and it didn't helped

Picasso.with(context).load(R.drawable.bg_partyt).into(holder.imageView); 

any ideas?

3
  • 1.5mb is large so try using Picasso's .fit() method. fit() will measure the dimensions of the target ImageView (@+id/im_item_icon) and then uses Picasso's own resize() method to reduce the image size to the dimensions of the target ImageView. More info here: futurestud.io/tutorials/picasso-image-resizing-scaling-and-fit Commented Nov 23, 2016 at 20:23
  • Can you post the layout code which includes recyclerView? Commented Nov 23, 2016 at 20:49
  • I am trying to use the .fit() but it just doesn't show the image at all. Commented Nov 23, 2016 at 22:45

1 Answer 1

1

your image is way to big.

You could try using Glide instead of picasso. It handles big images a little bit better https://github.com/bumptech/glide

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.