简体   繁体   English

RecyclerView滚动非常缓慢且缓慢

[英]RecyclerView scrolling very slow and laggy

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.. 嘿,我正在使用带有列表卡片设计的recyclerview,每张卡片上我都有一张图像,不是很大,它的重量为1.5 mb,我正在加载12张卡片,但是滚动太慢了,所以我尝试使用PICASSO,但并没有帮助,问题是,当我用一个较小的图像(300字节)替换图像时,它可以很好地滚动,但是不能解决我的问题。

the relevant part of the cards xml is: 卡xml的相关部分是:

 <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,但并没有帮助

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

any ideas? 有任何想法吗?

your image is way to big. 您的形象变得重要。

You could try using Glide instead of picasso. 您可以尝试使用Glide代替毕加索。 It handles big images a little bit better https://github.com/bumptech/glide 它可以更好地处理大图像https://github.com/bumptech/glide

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM