Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 422
Ion Aalbers Avatar asked Dec 04 '25 15:12

Ion Aalbers


1 Answers

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

like image 198
Aleks G Avatar answered Dec 06 '25 07:12

Aleks G