diff options
author | Philip Milne <pmilne@google.com> | 2011-06-09 18:30:32 -0700 |
---|---|---|
committer | Philip Milne <pmilne@google.com> | 2011-06-10 10:51:45 -0700 |
commit | f474870fe1189f73cf8ffbaba9e524ef194b5043 (patch) | |
tree | eca5a08ddacc888a57576cd018a46ee5a967202d /tests/GridLayoutTest | |
parent | f7728ae964f180081c8e1cb11c01d36e85dc8650 (diff) | |
download | frameworks_base-f474870fe1189f73cf8ffbaba9e524ef194b5043.zip frameworks_base-f474870fe1189f73cf8ffbaba9e524ef194b5043.tar.gz frameworks_base-f474870fe1189f73cf8ffbaba9e524ef194b5043.tar.bz2 |
Optimise the way that indices are auto-allocated so that XML files can normally avoid using indices.
Change-Id: Iafb25b17fec9391664c81a7e213eeaa918254912
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); |