You can create a GridView with any number of columns:

    <GridView android:id="@+id/categories"
              android:numColumns="5"
              android:horizontalSpacing="2dp"
              android:verticalSpacing="2dp"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"/>

You'll then need to either create a custom Adapter class, or use one
of the existing Adapter classes to render the data you want to appear
in the grid. There is no way to tell the GridView class to only render
a specified number of rows however, instead this is determined by the
number of elements being rendered and the number of the columns
available. Also bare in mind that a GridView will automatically scroll
if the data won't fit into it's allocated screen space.

You may instead want to look at using a TableLayout and a series of
programmatically created TableRow objects. However in this case you'll
loose all the binding code in Adapter and the lighter weight structure
on GridView (you'll be introducing another level of depth to your
widget tree).

Hope that helps a bit ;)
Regards
//Jason Morris

On Thu, Nov 17, 2011 at 10:41 AM, Pent <[email protected]> wrote:
>> You will have to create a custom component - best would be a heavyweight
>> component.
>
> Yes, I believe the standard grid only goes up to 3.
>
> Maybe check on the dev board though:
>
> http://groups.google.com/group/android-developers/topics
>
> Pent
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Android Discuss" 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-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" 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-discuss?hl=en.

Reply via email to