android 快速滑动时不加载图片大小,android – Glide是否排队每个图像请求?滚动时,Recyclerview加载速度非常慢...

我使用GridLayoutManager使用Glide 3.6一个RecyclerView在我们的应用程序中看到了很长的图像加载时间.图像大约为20kb-40kb.似乎滑动将所有请求排队,导致图像在开始向下滚动列表后需要花费很长时间才能加载.我已经附加了GenericRequest类的日志.

V/GenericRequest﹕ finished setup for calling load in 0.170291 this: 249721749

V/GenericRequest﹕ finished onSizeReady in 0.36724999999999997 this: 249721749

V/GenericRequest﹕ finished run method in 0.763083 this: 249721749

V/GenericRequest﹕ Got onSizeReady in 0.041249999999999995 this: 991315424

V/GenericRequest﹕ finished setup for calling load in 0.15479199999999999 this: 991315424

V/GenericRequest﹕ finished onSizeReady in 0.30008399999999996 this: 991315424

V/GenericRequest﹕ finished run method in 0.499959 this: 991315424

V/GenericRequest﹕ Got onSizeReady in 0.060584 this: 1029510845

V/GenericRequest﹕ finished setup for calling load in 0.200625 this: 1029510845

V/GenericRequest﹕ finished onSizeReady in 0.39233399999999996 this: 1029510845

V/GenericRequest﹕ finished run method in 0.670084 this: 1029510845

V/GenericRequest﹕ Got onSizeReady in 0.048374999999999994 this: 516458536

V/GenericRequest﹕ finished setup for calling load in 0.188666 this: 516458536

V/GenericRequest﹕ finished onSizeReady in 0.379916 this: 516458536

V/GenericRequest﹕ finished run method in 0.654083 this: 516458536

V/GenericRequest﹕ Resource ready in 1012.49325 size: 2.18359375 fromCache: false this: 671303046

V/GenericRequest﹕ Got onSizeReady in 0.073833 this: 356666200

V/GenericRequest﹕ finished setup for calling load in 0.240667 this: 356666200

V/GenericRequest﹕ finished onSizeReady in 0.460792 this: 356666200

V/GenericRequest﹕ finished run method in 0.780708 this: 356666200

V/GenericRequest﹕ Got onSizeReady in 0.064583 this: 347417463

V/GenericRequest﹕ finished setup for calling load in 0.242583 this: 347417463

V/GenericRequest﹕ finished onSizeReady in 0.45758299999999996 this: 347417463

V/GenericRequest﹕ finished run method in 0.7521249999999999 this: 347417463

V/GenericRequest﹕ Got onSizeReady in 0.142833 this: 671303046

V/GenericRequest﹕ finished setup for calling load in 0.38966599999999996 this: 671303046

V/GenericRequest﹕ finished onSizeReady in 0.703708 this: 671303046

V/GenericRequest﹕ finished run method in 1.851125 this: 671303046

V/GenericRequest﹕ Got onSizeReady in 0.056957999999999995 this: 634418527

V/GenericRequest﹕ finished setup for calling load in 0.21787499999999999 this: 634418527

V/GenericRequest﹕ finished onSizeReady in 0.443083 this: 634418527

V/GenericRequest﹕ finished run method in 0.7567499999999999 this: 634418527

V/GenericRequest﹕ Resource ready in 3443.041335 size: 2.18359375 fromCache: false this: 249721749

V/GenericRequest﹕ Resource ready in 4110.604794 size: 3.8623809814453125 fromCache: false this: 1054166306

V/GenericRequest﹕ Resource ready in 3824.033544 size: 3.8623809814453125 fromCache: false this: 991315424

V/GenericRequest﹕ Resource ready in 3773.0562109999996 size: 3.8623809814453125 fromCache: false this: 1029510845

V/GenericRequest﹕ Resource ready in 4542.90796 size: 2.18359375 fromCache: false this: 516458536

V/GenericRequest﹕ Resource ready in 4171.866168 size: 3.8623809814453125 fromCache: false this: 634418527

V/GenericRequest﹕ Resource ready in 4474.170752 size: 3.8623809814453125 fromCache: false this: 356666200

V/GenericRequest﹕ Resource ready in 4496.104085 size: 2.18359375 fromCache: false this: 671303046

V/GenericRequest﹕ Resource ready in 4814.625126999999 size: 2.18359375 fromCache: false this: 347417463

想知道是否有人能够提供一些有关问题的见解.也许它是调整视图大小所需的时间?我使用match_parent作为视图的宽度和固定高度约200dp.

使用加载图像

Glide.with(fragmentContext)

.load(imageUrl)

.centerCrop()

.placeholder(R.drawable.placeholder)

.into(viewHolder.productImage);

XML

android:id="@+id/product_image"

android:layout_width="match_parent"

android:layout_height="@dimen/product_image_height" (208dp)

android:layout_gravity="top"

android:background="@color/placeholder_bg"

/>

编辑:根据@VladimirMironov评论.我已经更新了池,并在视图被回收时清除了待处理的负载.这似乎在滚动快速时有所帮助.在查看测量时,是否为视图使用“match_parent”提供覆盖是否有任何好处?有些情况下,视图几乎不会显示5秒钟.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值