简体   繁体   English

使用服务器中的数据(图像)动态填充Horizo​​ntalScrollView

[英]Populate HorizontalScrollView dynamically with data (Images) from the server

I have a HorizontalScrollView which I want to populate with images that'll come from the server through a service. 我有一个HorizontalScrollView ,我要用服务器通过服务提供的图像填充该图像。 I'm unable to figure out how to integrate the said HorizontalScrollView with an adapter (maybe, BaseAdapter ) and a layout, which the adapter will populate as the data will come in. 我无法弄清楚如何将所说的HorizontalScrollView与适配器(也许是BaseAdapter )和布局集成在一起,适配器将在输入数据时填充该布局。

I want the HorizontalScrollView to have 10 images if server sends 10 image and 15, if the server sends 15 images. 如果服务器发送10张图像,我希望HorizontalScrollView包含10张图像,如果服务器发送15张图像,我希望得到15张图像。

In case of a listview , a cursor adapter or some other adapter can be used to populate the list dynamically. 在使用listview情况下,可以使用游标适配器或其他适配器来动态填充列表。 Is there any counterpart for HorizontalScrollLView which I can use? 我可以使用HorizontalScrollLView任何对应项吗?

You should check out ViewPager. 您应该签出ViewPager。 The Google example is pretty close to what you want to achieve Google示例非常接近您想要实现的目标

http://developer.android.com/training/animation/screen-slide.html http://developer.android.com/training/animation/screen-slide.html

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

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