Issue With GridLayout Rendering on phone



I am implementing a GridLayout in eclipse and laying out 4 EditText objects (input text fields) and 4 button objects which correspond to each EditText object. All the EditText objects are placed to the left and the buttons are placed to the right. There is extra spacing at the right edge of the screen which is not present in the graphic layout editor in eclipse. I am running the android application on a physical phone, not an emulator. In eclipse, there is a 1/8 inch space between the button objects and the right edge of the screen, but in the phone there is a 1/2 inch space between the button objects and the right edge of the screen. I have included the XML markup as well. Why is this happening?


thanks.


XML Markup



<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/editgalaxyscreen"
android:columnCount="2"
android:orientation="vertical"
android:rowCount="4"
android:useDefaultMargins="true" >

<EditText
android:id="@+id/edit_colony"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
android:hint="@string/hint_colony"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />

<EditText
android:id="@+id/edit_pop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="1"
android:hint="@string/hint_pop"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />

<EditText
android:id="@+id/edit_fleet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="2"
android:hint="@string/hint_fleet"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />

<EditText
android:id="@+id/edit_ships"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="3"
android:hint="@string/hint_ship"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />

<Button
android:id="@+id/submit_colony"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="0"
android:text="@string/ok_button"
android:textColor="#FFFFFF" />

<Button
android:id="@+id/submit_pop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="1"
android:text="@string/ok_button"
android:textColor="#FFFFFF" />

<Button
android:id="@+id/submit_fleet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="2"
android:text="@string/ok_button"
android:textColor="#FFFFFF" />

<Button
android:id="@+id/submit_ships"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:text="@string/ok_button"
android:textColor="#FFFFFF" />

</GridLayout>

No comments:

Post a Comment