summaryrefslogtreecommitdiffstats
path: root/tests/GridLayoutTest
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2011-07-21 11:39:37 -0700
committerPhilip Milne <pmilne@google.com>2011-07-25 12:12:10 -0700
commit5125e21bc0bbe5b9718d0f03b26cdafc67a7c726 (patch)
tree69107cc13318d24598a4e143d0359e8d4809c1ff /tests/GridLayoutTest
parente432a0005180ba9ac2c1d7822c4761b475fddc51 (diff)
downloadframeworks_base-5125e21bc0bbe5b9718d0f03b26cdafc67a7c726.zip
frameworks_base-5125e21bc0bbe5b9718d0f03b26cdafc67a7c726.tar.gz
frameworks_base-5125e21bc0bbe5b9718d0f03b26cdafc67a7c726.tar.bz2
Fix for http://b/issue?id=5064532
5064532: GridLayout with initial "stretchy" row and "gone" view in last row doesn't stretch properly Also: . Infer stretchibility from whether or not gravity is defined. . Make algorithms for handling flexibility within cell groups consistent with those acting between cells groups (via constraint system). . Hide and deprecate methods taking flexibility argument. . Hide and deprecate CAN_STRETCH constant. Both deprecated features will be removed after references are removed from platform. Change-Id: Iabf2bf19f35cf30b8ec49c99b49a0550fd495125
Diffstat (limited to 'tests/GridLayoutTest')
-rw-r--r--tests/GridLayoutTest/res/layout/grid3.xml15
-rw-r--r--tests/GridLayoutTest/src/com/android/test/layout/Activity2.java29
2 files changed, 23 insertions, 21 deletions
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml
index 3c2db54..2eca384 100644
--- a/tests/GridLayoutTest/res/layout/grid3.xml
+++ b/tests/GridLayoutTest/res/layout/grid3.xml
@@ -27,8 +27,8 @@
>
<TextView
- android:text="Email account"
- android:textSize="48dip"
+ android:text="Email setup"
+ android:textSize="32dip"
android:layout_columnSpan="4"
android:layout_gravity="center_horizontal"
@@ -36,7 +36,7 @@
<TextView
android:text="You can configure email in just a few steps:"
- android:textSize="20dip"
+ android:textSize="16dip"
android:layout_columnSpan="4"
android:layout_gravity="left"
@@ -49,7 +49,7 @@
/>
<EditText
- android:layout_width="100dip"
+ android:layout_width="64dip"
/>
<TextView
@@ -60,14 +60,14 @@
/>
<EditText
- android:layout_width="50dip"
+ android:layout_width="32dip"
/>
<Space
android:layout_row="4"
android:layout_column="2"
- android:layout_rowFlexibility="canStretch"
- android:layout_columnFlexibility="canStretch"
+ android:layout_margin="0dip"
+ android:layout_gravity="fill"
/>
<Button
@@ -75,7 +75,6 @@
android:layout_row="5"
android:layout_column="3"
- android:layout_gravity="fill_horizontal"
/>
<Button
diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
index 38a85a3..e1871ac 100644
--- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
+++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
@@ -38,30 +38,31 @@ public class Activity2 extends Activity {
vg.setUseDefaultMargins(true);
vg.setAlignmentMode(ALIGN_BOUNDS);
- Spec row1 = spec(0, CENTER);
- Spec row2 = spec(1, CENTER);
+ Spec row1 = spec(0);
+ Spec row2 = spec(1);
Spec row3 = spec(2, BASELINE);
Spec row4 = spec(3, BASELINE);
- Spec row5 = spec(4, FILL, CAN_STRETCH);
- Spec row6 = spec(5, CENTER);
- Spec row7 = spec(6, CENTER);
+ Spec row5 = spec(4, FILL);
+ Spec row6 = spec(5);
+ Spec row7 = spec(6);
Spec col1a = spec(0, 4, CENTER);
Spec col1b = spec(0, 4, LEFT);
Spec col1c = spec(0, RIGHT);
Spec col2 = spec(1, LEFT);
- Spec col3 = spec(2, FILL, CAN_STRETCH);
- Spec col4 = spec(3, FILL);
+ Spec col3 = spec(2, FILL);
+ Spec col4a = spec(3);
+ Spec col4b = spec(3, FILL);
{
TextView v = new TextView(context);
- v.setTextSize(48);
+ v.setTextSize(32);
v.setText("Email setup");
vg.addView(v, new LayoutParams(row1, col1a));
}
{
TextView v = new TextView(context);
- v.setTextSize(20);
+ v.setTextSize(16);
v.setText("You can configure email in just a few steps:");
vg.addView(v, new LayoutParams(row2, col1b));
}
@@ -75,7 +76,7 @@ public class Activity2 extends Activity {
v.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
{
LayoutParams lp = new LayoutParams(row3, col2);
- lp.width = (int) v.getPaint().measureText("Frederick.W.Flintstone@bedrock.com ");
+ lp.width = (int) v.getPaint().measureText("Frederick.W.Flintstone");
vg.addView(v, lp);
}
}
@@ -95,17 +96,19 @@ public class Activity2 extends Activity {
}
{
Space v = new Space(context);
- vg.addView(v, new LayoutParams(row5, col3));
+ LayoutParams lp = new LayoutParams(row5, col3);
+ lp.setMargins(0, 0, 0, 0);
+ vg.addView(v, lp);
}
{
Button v = new Button(context);
v.setText("Manual setup");
- vg.addView(v, new LayoutParams(row6, col4));
+ vg.addView(v, new LayoutParams(row6, col4a));
}
{
Button v = new Button(context);
v.setText("Next");
- vg.addView(v, new LayoutParams(row7, col4));
+ vg.addView(v, new LayoutParams(row7, col4b));
}
return vg;