简体   繁体   English

如何在简单的ListView中实现水平滚动视图?

[英]How to implement Horizontal Scroll View inside a simple ListView?

I am trying to implement Horizontal Scroll View inside a simple List View. 我正在尝试在一个简单的列表视图中实现水平滚动视图。 The elements inside the horizontal scroll view are texts over images. 水平滚动视图内的元素是图像上的文本。

I know I need to create the adapter and the getter & setter class as well for horizontal Scrolling elements. 我知道我需要为水平Scrolling元素创建适配器以及getter和setter类。

Also, the URLs of the images are stored in a string array. 同样,图像的URL存储在字符串数组中。 But I am not sure how to implement that. 但是我不确定如何实现。

Can any one suggest a good example for this? 有人可以为此提供一个很好的例子吗?

Thanks in advance. 提前致谢。

Before requesting for answer make sure you try to implement/google it. 在请求答案之前,请确保您尝试实施/搜索它。

I would suggest you to use RecyclerView instead of ListView . 我建议您使用RecyclerView而不是ListView

For your requirement you will need two Adapters one for your parent RecyclerView and another for your item if RecyclerView . 根据您的要求,您将需要两个适配器,一个用于您的父级RecyclerView ,另一个用于您的物品(如果是RecyclerView

Refer the link . 请参阅链接 It'll help you to achieve what you want 它会帮助您实现您想要的

将RecyclerView与LinearLayoutManager一起使用,并将其方向调整为水平

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

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