简体   繁体   English

是否可以在垂直 recyclerview 中有一个水平 recyclerview?

[英]Is it possible to have a horizontal recyclerview inside a vertical recyclerview?

The main recyclerview which is vertical recyclerview shows all the deals in the layout垂直recyclerview器视图的主要recyclerview器视图显示布局中的所有交易

But what I want to achieve is:但我想要实现的是:

  • after the first 10 deals, I want to display a (horizontal recyclerview) of 5 recommended deal在前 10 个交易之后,我想显示 5 个推荐交易的(水平回收视图)
  • after the next 10 deals, I want to display a (horizontal recyclerview) of 5 recommended deal在接下来的 10 笔交易之后,我想显示 5 笔推荐交易的(水平回收视图)
  • after the next 10 deals, I want to display a (horizontal recyclerview) of 5 recommended deal and so on…在接下来的 10 笔交易之后,我想显示 5 笔推荐交易的(水平回收视图)等等……

I have attached the image of how i want the design to look.我附上了我希望设计外观的图像。

I have no clue on how to implement this.我不知道如何实现这一点。 But I have both the recyclerview working separately.但我有两个recyclerview分开工作。 Just not sure how to combine them.只是不知道如何组合它们。 I'm not even sure to code in the adapters or the main activity.我什至不确定在适配器或主要活动中编写代码。 I have attached the image of the horizontal recyclerview adapter and vertical recyclerview adapter.我附上了水平 recyclerview 适配器和垂直 recyclerview 适配器的图像。 Please help me by showing me how to implement this feature.请通过向我展示如何实现此功能来帮助我。 Thanks谢谢

For that purpose you can use NestedScrollView.为此,您可以使用 NestedScrollView。 NestedScrollView as the name suggests is used when there is a need for a scrolling view inside another scrolling view.顾名思义,NestedScrollView 用于在另一个滚动视图中需要滚动视图时使用。

you can set like this:你可以这样设置:

android:nestedScrollingEnabled="true" 

According to your requirement.根据你的要求。

I can't picture what exactly you want to achieve, but if you want to have vertical recyclerview which contains horizontal recyclerview, than you need to add adapter into adapter.我无法想象您到底想要实现什么,但是如果您想要拥有包含水平 recyclerview 的垂直 recyclerview,那么您需要将适配器添加到适配器中。

Item view that you use for vertical recyclerview should also contain recyclerview.用于垂直 recyclerview 的项目视图也应该包含 recyclerview。

This should be good reference on how to achieve it. 应该是如何实现它的很好的参考。

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

相关问题 水平RecyclerView内部的水平RecyclerView - Horizontal RecyclerView inside a Horizontal RecyclerView 垂直recyclerView和水平recyclerview一起滚动 - vertical recyclerView and Horizontal recyclerview scrolling together 相同布局中的垂直和水平 Recyclerview - Vertical and Horizontal Recyclerview in the same layout RecyclerView Android内部的2垂直和2水平卡视图 - 2-vertical and 2-horizontal card views inside recyclerview android RecyclerView - 垂直滚动的水平列表 - RecyclerView - horizontal list with vertical scrolling Horizo​​ntal RecyclerView 里面的 RecyclerView 里面的 CoordinatorLayout - Horizontal RecyclerView inside RecyclerView that inside CoordinatorLayout 如何修复垂直 RecyclerView 内的水平 ViewPager2 和 RecyclerView 的滚动问题? - How to fix Scrolling issue of horizontal ViewPager2 and RecyclerView that are inside a vertical RecyclerView? 在垂直recyclerview中创建水平recyclerview,例如与Google Play齐射 - create horizontal recyclerview in vertical recyclerview like google play store with volley 垂直recyclerview(包括水平recyclerview)无法正常工作 - Vertical recyclerview (which includes horizontal recyclerview) is not working properly 如何在垂直回收站视图上添加水平滚动? - How to add horizontal scroll on vertical recyclerview?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM