I have a gridview that is inflated by multiple buttons. I used just a gridview and it worked fine. The grid was in correct order and was centered. Although, I wanted to add a button below the grid of buttons that was different and centered. To do this I decided to section off the gridview and then add the button (therefore it wouldn't be affected by the gridview). I tried the following code to seperate the views:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:id="@+id/tbl_gridcreator"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<TableRow>
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="150px"
android:numColumns="7"
android:stretchMode="spacingWidthUniform"
android:gravity="center">
<!--
android:horizontalSpacing="0px" -->
</GridView>
</TableRow>
<TableRow android:gravity="center">
<Button android:text="Submit"
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</TableRow>
</TableLayout>
</LinearLayout>
The problem is that this code smushes the gridview to the left and oddly it flips it (Position 0 is ont he bottom right and the last button is on the top left pushed off screen). The following image shows what is the result:
Any idea why its pushed to the left and flipped? Or maybe how I could have just the Gridview with the button on the bottom?