简体   繁体   中英

Vertical 'Gridview with pages' or 'Viewpager'

What I functionally need is a Vertical ViewPager with GridView . So every page of the ViewPager should have a GridView , but the ViewPager is horizontal.

So there are two possibilities:

  • Rotate the ViewPager with GridViews
  • Create a GridView that shows the items in pages

The GridView should show 0-20 when the user scrolls 20-40 etc etc.

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. Although Android only provides a horizontal one, there's nothing that prevents you from implementing it yourself. Get the ViewPager source code and modify it to detect swipes up/down instead of left/right. 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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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