问题描述
我试图让使用HorizontalScrollView图库部件,所以HorizontalScrollView里面我加ImageViews,问题是,我要加600 +的图像!结果
我可以做出某种自定义适配器,以覆盖GetView方法,并利用convertView为了使应用程序更顺畅,避免在同一时间增加600多意见?
I'm trying to make a Gallery widget using HorizontalScrollView, So inside the HorizontalScrollView I add ImageViews, and the problem is that I'm going to add 600+ images!
Can I make some kind of a custom adapter in order to override the GetView method and utilize convertView in order to make the app smoother and avoid adding 600+ views at the same time?
推荐答案
HorizontalScrollView只能包含一个视图,所以你要你画绘制它的任何部分的整体视图随时随地。这可能,但是,围绕由
HorizontalScrollView can contain only one View, so you have to draw that whole View anytime you are drawing any part of it. This could, however, be worked around by
- 扩展的ViewGroup作为HorizontalScrollView的孩子
- 使用在你的ViewGroup自定义适配器,并调用getView(),并在自己的回收,仅绘制当前在您的HorizontalScrollView可见视图
但是,这会,如果你的时间走了很多。我想至少尝试像HorizontalListView第一。如何 - 对特定类别可以发现。
But this would take a lot if your time. I'd at least try something like HorizontalListView first. A how-to of that specific class can be found here.
这篇关于HorizontalScrollView自定义适配器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!