On Tue, Jan 17, 2012 at 7:31 AM, Dave <[email protected]> wrote:
> http://developer.android.com/reference/android/widget/GridView.html
>
> The default way the elements of the array is put in a GridView is
> zigzagging left-right-down.
>
> e.g. array {1,2,3,4,5,6,7,8,9,10} becomes
> by default (with columns fixed to 3)
>
> 1,2,3
> 4,5,6
> 7,8,9
> 10
>
> Is there a way to get to zigzag up-down-right (with rows fixed to 3)?
>
> 1,4,7,10
> 2,5,8
> 3,6,9

Change your adapter to serve out the items in that order. Or, rewrite
GridView. Note that your example shows a mismatch of columns (4 in
first row, 3 in others), which GridView does not support, except for
the last row.

> Also I like to be able to enforce a column move in getView. Free
> zigzag style: No fixed number of columns columns or rows:
> For instance in free up-down-right zigzag
> 1,5,6,9
> 2,   7,10
> 3,   8
> 4

Write your own AdapterView.

If you do not need selection events and your roster of items is small
enough (<100), the new GridLayout in Android 4.0, wrapped in a
ScrollView, can probably handle what you need. I think I saw a
backport of GridLayout for earlier versions of Android floating around
GitHub.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to