I have a GridView that I want to be 4 equally sized TextViews in a 2 x 2 GridView. I want the TextViews to be centered within their respective quadrant of the GridView.
My first issue is that nothing is centering. Everything gravitates to the left. My second is that while I can get the column width to size to 50% of the available width, I can’t figure out how to get the row height to adjust to 50% of available height. Weight only seems to work one way.
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyGrid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"
android:verticalSpacing="5dp"
android:horizontalSpacing="10dp"
android:numColumns="2"
android:columnWidth="400dp"
android:stretchMode="columnWidth"
android:layout_weight=".5"
android:gravity="center">
</GridView>
Portrait View

Landscape View

What you maybe want is to use a
TableLayoutinstead. TheGridViewis similar to aListViewthat has items, but in this case, you want to have only 4 items rather than an indefinite amount.GridView
TableLayout
Here is a snippet of xml that will work: