将批量的图像加载到自动滚动列表中
我正在尝试为Android TV应用程序实施技巧。当用户按下并保留FF/RW按钮时,我有在自动滚动Recylerview中显示的本地文件URL列表。
我没有在这种情况下使用Glide,因为它主要显示空图像,因为滚动速度非常快,以至于
更快地显示图像,我正在创建listable>
通过创建可绘制的可绘图
// image cacher
for (int i = 0; i < length; i++) {
cachedImageList.add(Drawable.createFromPath(getPath(i)));
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.getImageCardView().setImageDrawable(cachedImageList.get(position));
}
我也将可绘制的参考清除为一旦回收,
public void onViewRecycled(final MyViewHolder holder) {
holder.getImageCardView().setImageDrawable(null);
}
当我将绘制可绘制的列表加载到列表中时,我会看到内存尖峰。即使在调用cachedimagelist.clear()
内存也不会返回正常。
在非常快速的滚动回收时,将大量小型绘制的小型绘制的最佳方法是什么?
谢谢
I am trying to implement trickplay for android TV app. I have list of local file urls to show in auto scrolling RecylerView when user press and hold FF/RW buttons.
I am not using glide for this case because it mostly shows empty images as the scroll speed is so fast
To show images faster I am creating List<Drawable>
by creating Drawable
// image cacher
for (int i = 0; i < length; i++) {
cachedImageList.add(Drawable.createFromPath(getPath(i)));
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.getImageCardView().setImageDrawable(cachedImageList.get(position));
}
I am also clearing the Drawable reference as soon as view is recycled
public void onViewRecycled(final MyViewHolder holder) {
holder.getImageCardView().setImageDrawable(null);
}
I am seeing a memory spike when I load the Drawable into list. Even after calling cachedImageList.clear()
memory does not return to normal.
What should be the best way to load lots of small Drawable into very fast scrolling RecyclView?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论