summaryrefslogtreecommitdiffstats
path: root/tests/GridLayoutTest
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2011-08-05 11:04:36 -0700
committerPhilip Milne <pmilne@google.com>2011-08-05 11:24:55 -0700
commitb559976a50c34848d602cc7138859507a379893c (patch)
tree56da177ef94736006ca1141cb8e0f22394a85d35 /tests/GridLayoutTest
parentb491877331cab95b8d2f9191a674476f826f92a5 (diff)
downloadframeworks_base-b559976a50c34848d602cc7138859507a379893c.zip
frameworks_base-b559976a50c34848d602cc7138859507a379893c.tar.gz
frameworks_base-b559976a50c34848d602cc7138859507a379893c.tar.bz2
Remove call to setPadding() in setUseDefaultMargins().
It is not possible for teh user to override the assigned padding values because the XML attributes are processed in the opposite order. Also, make the XML and Java examples grid3.xml and Activity2.java consistent in preparation for a move to API demos. Change-Id: I47334f9f5a46a8a528067d88350dd70eaa38ff33
Diffstat (limited to 'tests/GridLayoutTest')
-rw-r--r--tests/GridLayoutTest/res/layout/grid3.xml9
-rw-r--r--tests/GridLayoutTest/src/com/android/test/layout/Activity2.java16
2 files changed, 9 insertions, 16 deletions
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml
index 2eca384..0e53613 100644
--- a/tests/GridLayoutTest/res/layout/grid3.xml
+++ b/tests/GridLayoutTest/res/layout/grid3.xml
@@ -22,6 +22,7 @@
android:useDefaultMargins="true"
android:alignmentMode="alignBounds"
+ android:rowOrderPreserved="false"
android:columnCount="4"
>
@@ -49,7 +50,7 @@
/>
<EditText
- android:layout_width="64dip"
+ android:ems="10"
/>
<TextView
@@ -60,13 +61,13 @@
/>
<EditText
- android:layout_width="32dip"
+ android:ems="8"
/>
<Space
- android:layout_row="4"
+ android:layout_row="2"
+ android:layout_rowSpan="3"
android:layout_column="2"
- android:layout_margin="0dip"
android:layout_gravity="fill"
/>
diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
index 907ee9c..8974f37 100644
--- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
+++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
@@ -38,7 +38,6 @@ public class Activity2 extends Activity {
p.setUseDefaultMargins(true);
p.setAlignmentMode(ALIGN_BOUNDS);
p.setRowOrderPreserved(false);
- p.setPadding(0, 0, 0, 0);
Spec row1 = spec(0);
Spec row2 = spec(1);
@@ -75,12 +74,9 @@ public class Activity2 extends Activity {
}
{
EditText c = new EditText(context);
+ c.setEms(10);
c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
- {
- LayoutParams lp = new LayoutParams(row3, col2);
- lp.width = (int) c.getPaint().measureText("Frederick.W.Flintstone");
- p.addView(c, lp);
- }
+ p.addView(c, new LayoutParams(row3, col2));
}
{
TextView c = new TextView(context);
@@ -89,17 +85,13 @@ public class Activity2 extends Activity {
}
{
TextView c = new EditText(context);
+ c.setEms(8);
c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
- {
- LayoutParams lp = new LayoutParams(row4, col2);
- lp.width = (int) c.getPaint().measureText("************");
- p.addView(c, lp);
- }
+ p.addView(c, new LayoutParams(row4, col2));
}
{
Space c = new Space(context);
LayoutParams lp = new LayoutParams(row5, col3);
- lp.setMargins(0, 0, 0, 0);
p.addView(c, lp);
}
{