Android-如何改善其中包含大量视图/图像的Horizo​​ntalScrollView [英] Android - how to improve HorizontalScrollView that has lots of views/images inside

查看:55
本文介绍了Android-如何改善其中包含大量视图/图像的Horizo​​ntalScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Horizo​​ntalScrollView,里面有很多视图和图像. 问题是,如果我里面有很多东西,我会收到"java.lang.OutOfMemoryError:位图大小超出VM预算"

I have a HorizontalScrollView that has lots of views and images inside it. The issue is that if I have lots of stuff inside it I will get a 'java.lang.OutOfMemoryError: bitmap size exceeds VM budget'

有什么方法可以使用某种缓存,或者在我向左/向右移动时添加/删除东西,以便它不会一直存储在内存中?

is there any way to use some kind of cache, or add/remove stuff as I move left/right so its not on memory all the time?

谢谢

推荐答案

我认为您想要的是现有的

I think what you want is the existing Gallery widget provided by Android.

Gallery是一个布局小部件,用于在水平滚动列表中显示项目并将当前选择项放置在视图的中心.

Gallery is a layout widget used to display items in a horizontally scrolling list and positions the current selection at the center of the view.

这篇关于Android-如何改善其中包含大量视图/图像的Horizo​​ntalScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆