简体   繁体   English

垂直'Gridview with pages'或'Viewpager'

[英]Vertical 'Gridview with pages' or 'Viewpager'

What I functionally need is a Vertical ViewPager with GridView . 我在功能上需要的是Vertical ViewPager with GridViewVertical ViewPager with GridView So every page of the ViewPager should have a GridView , but the ViewPager is horizontal. 因此, ViewPager每个页面ViewPager应该有一个GridView ,但ViewPager是水平的。

So there are two possibilities: 所以有两种可能性:

  • Rotate the ViewPager with GridViews 使用GridViews旋转ViewPager
  • Create a GridView that shows the items in pages 创建一个显示页面中项目的GridView

The GridView should show 0-20 when the user scrolls 20-40 etc etc. 当用户滚动20-40等时,GridView应显示0-20。

Does anyone have a solution for this? 有人有解决方案吗?

I have checked this link , but I cannot use it cause of legal reasons. 我已经检查了这个链接 ,但由于法律原因我无法使用它。

Sounds like what you really need is a vertical ViewPager. 听起来你真正需要的是一个垂直的ViewPager。 Although Android only provides a horizontal one, there's nothing that prevents you from implementing it yourself. 虽然Android只提供横向的,但没有什么可以阻止你自己实现它。 Get the ViewPager source code and modify it to detect swipes up/down instead of left/right. 获取ViewPager源代码并对其进行修改以检测向上/向下滑动而不是向左/向右滑动。 The source is distributed under Apache 2.0 license, therefore you have full rights to create derivative works without having to distribute the source of it. 源代码在Apache 2.0许可下分发,因此您拥有创建衍生作品的全部权利,而无需分发源代码。

There will be very few places to change, specifically, methods related to computing the swipe direction/slope (up/down instead of left/right) and methods related to layout computation (using height instead of width and layout pages below each other). 将会有很少的地方需要改变,特别是与计算滑动方向/斜率(向上/向下而不是向左/向右)相关的方法以及与布局计算相关的方法(使用高度而不是宽度和布局页面彼此相同)。

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

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