diff options
Diffstat (limited to 'tests/GridLayoutTest')
3 files changed, 42 insertions, 39 deletions
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml index ace7b4c..31dc75a 100644 --- a/tests/GridLayoutTest/res/layout/grid3.xml +++ b/tests/GridLayoutTest/res/layout/grid3.xml @@ -19,59 +19,61 @@ android:layout_width="match_parent" android:layout_height="match_parent" + android:useDefaultMargins="true" + android:marginsIncludedInAlignment="false" + android:columnCount="4" > - <Button - android:text="fill" - android:width="200dip" - android:height="100dip" - android:layout_marginLeft="50dip" - android:layout_row="0" - android:layout_column="0" - android:layout_gravity="fill_horizontal" + <TextView + android:text="Email account" + android:textSize="48dip" + android:layout_columnSpan="4" + android:layout_gravity="center_horizontal" /> - <EditText - android:layout_row="0" - android:layout_column="1" + <TextView + android:text="You can configure email in just a few steps:" + android:textSize="20dip" + android:layout_columnSpan="4" + android:layout_gravity="left" /> - <Button - android:text="left" - android:layout_row="1" - android:layout_column="0" + <TextView + android:text="Email address:" + android:layout_gravity="right" /> <EditText - android:layout_row="1" - android:layout_column="1" + android:layout_width="100dip" /> - <Button - android:text="right" - android:layout_row="2" + <TextView + android:text="Password:" android:layout_column="0" android:layout_gravity="right" /> <EditText - android:layout_margin="50dip" - android:textSize="100dip" - android:layout_row="2" - android:layout_column="1" + android:layout_width="50dip" /> - <Button - android:text="center" - android:layout_row="3" - android:layout_column="0" - android:layout_gravity="center_horizontal" + <Space + android:layout_rowWeight="1" + android:layout_columnWeight="1" + android:layout_row="4" + android:layout_column="2" /> - <EditText - android:layout_height="fill_parent" - android:layout_row="3" - android:layout_column="1" + <Button + android:text="Manual setup" + android:layout_row="5" + android:layout_column="3" + android:layout_gravity="fill_horizontal" /> + <Button + android:text="Next" + android:layout_column="3" + android:layout_gravity="fill_horizontal" + /> </GridLayout> diff --git a/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java index 937eacb..4d3a843 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java @@ -19,19 +19,19 @@ package com.android.test.layout; import android.app.Activity; import android.content.Context; import android.os.Bundle; -import android.os.Debug; import android.util.Log; -import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import static android.view.Gravity.*; + public abstract class AbstractLayoutTest extends Activity { - public static final String[] HORIZONTAL_NAMES = new String[] { "LEFT", "center", "east", "fill" }; - public static final int[] HORIZONTAL_ALIGNMENTS = new int[] { Gravity.LEFT, Gravity.CENTER, Gravity.RIGHT, Gravity.FILL }; - public static final String[] VERTICAL_NAMES = new String[] { "north", "center", "baseline", "south", "fill" }; - public static final int[] VERTICAL_ALIGNMENTS = new int[] { Gravity.TOP, Gravity.CENTER, Gravity.NO_GRAVITY, Gravity.BOTTOM, Gravity.FILL }; + public static final String[] HORIZONTAL_NAMES = { "LEFT", "CENTER", "RIGHT", "FILL" }; + public static final int[] HORIZONTAL_ALIGNMENTS = { LEFT, CENTER, RIGHT, FILL }; + public static final String[] VERTICAL_NAMES = { "TOP", "CENTER", "BASELINE", "BOTTOM", "FILL" }; + public static final int[] VERTICAL_ALIGNMENTS = { TOP, CENTER, NO_GRAVITY, BOTTOM, FILL }; public View create(Context context, String name, int size) { Button result = new Button(context); diff --git a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java index 2eecb8a..c5681e2 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java @@ -36,6 +36,7 @@ public class GridLayoutTest extends AbstractLayoutTest { GridLayout.Group rowGroup = new GridLayout.Group(UNDEFINED, null); GridLayout.Group colGroup = new GridLayout.Group(UNDEFINED, null); GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowGroup, colGroup); + //GridLayout.LayoutParams lp = new GridLayout.LayoutParams(); lp.setGravity(va | ha); View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20); container.addView(v, lp); |