Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jess-anders/two-way-gridview
An Android GridView that can be configured to scroll horizontally or vertically
https://github.com/jess-anders/two-way-gridview
Last synced: 2 months ago
JSON representation
An Android GridView that can be configured to scroll horizontally or vertically
- Host: GitHub
- URL: https://github.com/jess-anders/two-way-gridview
- Owner: jess-anders
- Created: 2012-09-03T16:10:09.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-01T00:13:44.000Z (over 9 years ago)
- Last Synced: 2024-07-01T10:58:10.956Z (7 months ago)
- Language: Java
- Size: 296 KB
- Stars: 650
- Watchers: 50
- Forks: 264
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-android-ui - https://github.com/jess-anders/two-way-gridview
- awesome-android-ui - https://github.com/jess-anders/two-way-gridview
README
TwoWayGridView
==============An Android GridView that can be configured to scroll horizontally or vertically.
I should have posted this over a year and a half ago, but never got around to it. I needed a grid view that in portrait would scroll vertically, but in landscape, would scroll horizontally. I thought I could try hacking up the Gallery, but that never works out well, and if GridView could really be configured to scroll any direction, it would just be so much easier.
So I built it one weekend. Lots of left, right, top, bottom changes, but the end result is a really useful UI widget.
Feel free to use it in your apps, according to the Apache 2.0 license. Also feel free to fork it and improve it. You could fairly easily create a horizontal listview by extending TwoWayAbsListView
Usage
-----The TwoWayGridView can be used as a drop-in replacement for the normal Android GridView. It just has a few more configurable attributes:
* `scrollDirectionPortrait` (vertical | horizontal) The direction the grid will scroll when the device is in portrait orientation
* `scrollDirectionLandscape` (vertical | horizontal) The direction the grid will scroll when the device is in landscape orientation
* `numRows` (integer) Number of rows in grid view when in horizontal scrolling mode
* `verticalSpacing` (dimension) Height of vertical spacing between grid rows
* `rowHeight` (dimension) Height of each grid rowHere is an example from the demo layout where it is configured to scroll vertically in portrait and horizontally in landscape :