summaryrefslogtreecommitdiffstats
path: root/tests/GridLayoutTest
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2011-06-13 10:44:49 -0700
committerPhilip Milne <pmilne@google.com>2011-06-13 10:44:49 -0700
commit51f17d54613c33638c8a2da8affcd9ba35994cb3 (patch)
tree06e4240a72a2528dcfe3e21c8a2c4f19bbedcac6 /tests/GridLayoutTest
parent60f36a52ac57018d33b284ee5b4f71ba869f54f0 (diff)
downloadframeworks_base-51f17d54613c33638c8a2da8affcd9ba35994cb3.zip
frameworks_base-51f17d54613c33638c8a2da8affcd9ba35994cb3.tar.gz
frameworks_base-51f17d54613c33638c8a2da8affcd9ba35994cb3.tar.bz2
Bugfix for GridLayout assuming that the x value of last column index is maximal. This is not the case when column indexes are defined incorrectly and GridLayout should still work in this case.
Change-Id: I5deb3fb43ed1dd16dd20868854b96ebae4d30623
Diffstat (limited to 'tests/GridLayoutTest')
-rw-r--r--tests/GridLayoutTest/res/layout/grid3.xml12
-rw-r--r--tests/GridLayoutTest/src/com/android/test/layout/Activity2.java28
2 files changed, 22 insertions, 18 deletions
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml
index 31dc75a..5cdacf7 100644
--- a/tests/GridLayoutTest/res/layout/grid3.xml
+++ b/tests/GridLayoutTest/res/layout/grid3.xml
@@ -19,14 +19,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
+
android:useDefaultMargins="true"
android:marginsIncludedInAlignment="false"
+
android:columnCount="4"
>
<TextView
android:text="Email account"
android:textSize="48dip"
+
android:layout_columnSpan="4"
android:layout_gravity="center_horizontal"
/>
@@ -34,12 +37,14 @@
<TextView
android:text="You can configure email in just a few steps:"
android:textSize="20dip"
+
android:layout_columnSpan="4"
android:layout_gravity="left"
/>
<TextView
android:text="Email address:"
+
android:layout_gravity="right"
/>
@@ -49,6 +54,7 @@
<TextView
android:text="Password:"
+
android:layout_column="0"
android:layout_gravity="right"
/>
@@ -58,14 +64,15 @@
/>
<Space
- android:layout_rowWeight="1"
- android:layout_columnWeight="1"
android:layout_row="4"
android:layout_column="2"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
/>
<Button
android:text="Manual setup"
+
android:layout_row="5"
android:layout_column="3"
android:layout_gravity="fill_horizontal"
@@ -73,6 +80,7 @@
<Button
android:text="Next"
+
android:layout_column="3"
android:layout_gravity="fill_horizontal"
/>
diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
index 5e29cf1..32365d7 100644
--- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
+++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
@@ -20,11 +20,15 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
-
-import android.widget.*;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.GridLayout;
+import android.widget.Space;
+import android.widget.TextView;
import static android.text.InputType.TYPE_CLASS_TEXT;
-import static android.view.inputmethod.EditorInfo.*;
+import static android.view.inputmethod.EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+import static android.view.inputmethod.EditorInfo.TYPE_TEXT_VARIATION_PASSWORD;
import static android.widget.GridLayout.*;
public class Activity2 extends Activity {
@@ -42,12 +46,12 @@ public class Activity2 extends Activity {
Group row6 = new Group(6, CENTER);
Group row7 = new Group(7, CENTER);
- Group col1a = new Group(1, 5, CENTER);
- Group col1b = new Group(1, 5, LEFT);
+ Group col1a = new Group(1, 4, CENTER);
+ Group col1b = new Group(1, 4, LEFT);
Group col1c = new Group(1, RIGHT);
- Group col2 = new Group(2, LEFT);
- Group col3 = new Group(3, FILL);
- Group col4 = new Group(4, FILL);
+ Group col2 = new Group(2, LEFT);
+ Group col3 = new Group(3, FILL);
+ Group col4 = new Group(4, FILL);
{
TextView v = new TextView(context);
@@ -55,20 +59,17 @@ public class Activity2 extends Activity {
v.setText("Email setup");
vg.addView(v, new LayoutParams(row1, col1a));
}
-
{
TextView v = new TextView(context);
v.setTextSize(20);
v.setText("You can configure email in just a few steps:");
vg.addView(v, new LayoutParams(row2, col1b));
}
-
{
TextView v = new TextView(context);
v.setText("Email address:");
vg.addView(v, new LayoutParams(row3, col1c));
}
-
{
EditText v = new EditText(context);
v.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
@@ -78,13 +79,11 @@ public class Activity2 extends Activity {
vg.addView(v, lp);
}
}
-
{
TextView v = new TextView(context);
v.setText("Password:");
vg.addView(v, new LayoutParams(row4, col1c));
}
-
{
TextView v = new EditText(context);
v.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
@@ -94,7 +93,6 @@ public class Activity2 extends Activity {
vg.addView(v, lp);
}
}
-
{
Space v = new Space(context);
{
@@ -104,13 +102,11 @@ public class Activity2 extends Activity {
vg.addView(v, lp);
}
}
-
{
Button v = new Button(context);
v.setText("Manual setup");
vg.addView(v, new LayoutParams(row6, col4));
}
-
{
Button v = new Button(context);
v.setText("Next");