Support for maximum values in layout GridLayout.

A cell's ability to shrink or stretch is now integrated with the
constraints system, which is now supplied with both upper and lower
bounds.

Also:

. Remove package private access (pseudo) annotation
. Remove rowWeight and columnWeight attributes and fields
. Remove code to handle weights

Change-Id: I9e2432101d15466c621f51ae362435051fab5764
This commit is contained in:
Philip Milne
2011-06-29 11:09:45 -07:00
parent 748d9f2fe4
commit 48b55244d2
10 changed files with 481 additions and 338 deletions

View File

@@ -596,10 +596,10 @@ package android {
field public static final int layout_centerInParent = 16843151; // 0x101018f
field public static final int layout_centerVertical = 16843153; // 0x1010191
field public static final int layout_column = 16843084; // 0x101014c
field public static final int layout_columnSpan = 16843646; // 0x101037e
field public static final int layout_columnWeight = 16843647; // 0x101037f
field public static final int layout_columnSpan = 16843645; // 0x101037d
field public static final int layout_gravity = 16842931; // 0x10100b3
field public static final int layout_height = 16842997; // 0x10100f5
field public static final int layout_heightSpec = 16843647; // 0x101037f
field public static final int layout_margin = 16842998; // 0x10100f6
field public static final int layout_marginBottom = 16843002; // 0x10100fa
field public static final int layout_marginEnd = 16843675; // 0x101039b
@@ -609,13 +609,13 @@ package android {
field public static final int layout_marginTop = 16843000; // 0x10100f8
field public static final int layout_row = 16843643; // 0x101037b
field public static final int layout_rowSpan = 16843644; // 0x101037c
field public static final int layout_rowWeight = 16843645; // 0x101037d
field public static final int layout_scale = 16843155; // 0x1010193
field public static final int layout_span = 16843085; // 0x101014d
field public static final int layout_toLeftOf = 16843138; // 0x1010182
field public static final int layout_toRightOf = 16843139; // 0x1010183
field public static final int layout_weight = 16843137; // 0x1010181
field public static final int layout_width = 16842996; // 0x10100f4
field public static final int layout_widthSpec = 16843646; // 0x101037e
field public static final int layout_x = 16843135; // 0x101017f
field public static final int layout_y = 16843136; // 0x1010180
field public static final int left = 16843181; // 0x10101ad
@@ -24890,9 +24890,9 @@ package android.widget {
}
public class GridLayout extends android.view.ViewGroup {
ctor public GridLayout(android.content.Context);
ctor public GridLayout(android.content.Context, android.util.AttributeSet, int);
ctor public GridLayout(android.content.Context, android.util.AttributeSet);
ctor public GridLayout(android.content.Context);
method public int getAlignmentMode();
method public int getColumnCount();
method public int getOrientation();
@@ -24912,8 +24912,11 @@ package android.widget {
field public static final int ALIGN_MARGINS = 1; // 0x1
field public static final android.widget.GridLayout.Alignment BASELINE;
field public static final android.widget.GridLayout.Alignment BOTTOM;
field public static final android.widget.GridLayout.Spec CAN_SHRINK;
field public static final android.widget.GridLayout.Spec CAN_STRETCH;
field public static final android.widget.GridLayout.Alignment CENTER;
field public static final android.widget.GridLayout.Alignment FILL;
field public static final android.widget.GridLayout.Spec FIXED;
field public static final int HORIZONTAL = 0; // 0x0
field public static final android.widget.GridLayout.Alignment LEFT;
field public static final android.widget.GridLayout.Alignment RIGHT;
@@ -24940,9 +24943,13 @@ package android.widget {
ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
method public void setGravity(int);
field public android.widget.GridLayout.Group columnGroup;
field public float columnWeight;
field public android.widget.GridLayout.Spec heightSpec;
field public android.widget.GridLayout.Group rowGroup;
field public float rowWeight;
field public android.widget.GridLayout.Spec widthSpec;
}
public static abstract class GridLayout.Spec {
ctor public GridLayout.Spec();
}
public class GridView extends android.widget.AbsListView {

File diff suppressed because it is too large Load Diff

View File

@@ -156,7 +156,7 @@
/>
<!-- Column 1 -->
<Space android:layout_columnWeight="1" android:layout_rowSpan="11" />
<Space android:layout_widthSpec="canStretch" android:layout_rowSpan="11" />
<!-- Column 2 - password entry field and PIN keyboard -->
<LinearLayout

View File

@@ -169,7 +169,10 @@
</LinearLayout>
<!-- Column 1 -->
<Space android:width="20dip" android:layout_columnWeight="1" android:layout_rowSpan="10" />
<Space
android:width="20dip"
android:layout_heightSpec="canStretch"
android:layout_rowSpan="10" />
<!-- Column 2 -->
<com.android.internal.widget.multiwaveview.MultiWaveView

View File

@@ -100,9 +100,11 @@
<!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working -->
<Space
android:layout_height="43dip"
android:layout_gravity="fill"
android:layout_rowWeight="1" android:layout_columnWeight="1" />
android:layout_height="43dip"
android:layout_gravity="fill"
android:layout_heightSpec="canStretch"
android:layout_widthSpec="canStretch"
/>
<TextView android:id="@+id/carrier"
android:layout_gravity="right"

View File

@@ -125,7 +125,7 @@
android:layout_marginBottom="4dip"
android:layout_marginLeft="8dip"
android:layout_gravity="center|bottom"
android:layout_rowWeight="1"
android:layout_heightSpec="canStretch"
/>
<TextView

View File

@@ -3324,11 +3324,6 @@
The default is one.
See {@link android.widget.GridLayout.Group}. -->
<attr name="layout_rowSpan" format="integer" min="1" />
<!-- A number indicating the relative proportion of available space that
should be taken by this group of cells.
The default is zero.
See {@link android.widget.GridLayout.LayoutParams#columnWeight}. -->
<attr name="layout_rowWeight" format="float" />
<!-- The column boundary delimiting the left of the group of cells
occupied by this view. -->
<attr name="layout_column" />
@@ -3337,15 +3332,38 @@
The default is one.
See {@link android.widget.GridLayout.Group}. -->
<attr name="layout_columnSpan" format="integer" min="1" />
<!-- A number indicating the relative proportion of available space that
should be taken by this group of cells.
The default is zero.
See {@link android.widget.GridLayout.LayoutParams#columnWeight}.-->
<attr name="layout_columnWeight" format="float" />
<!-- Gravity specifies how a component should be placed in its group of cells.
The default is LEFT | BASELINE.
See {@link android.widget.GridLayout.LayoutParams#setGravity(int)}. -->
<attr name="layout_gravity" />
<!-- A value specifying how much deficit or excess width this component can accomodate.
The default is FIXED.
See {@link android.widget.GridLayout.LayoutParams#widthSpec}.-->
<attr name="layout_widthSpec" >
<!-- If possible, width should be exactly as specified.
See {@link android.widget.GridLayout#FIXED}. -->
<enum name="fixed" value="0" />
<!-- If possible, width should be less than or equal to the specified width.
See {@link android.widget.GridLayout#CAN_SHRINK}. -->
<enum name="canShrink" value="1" />
<!-- If possible, width should be greater than or equal to the specified width.
See {@link android.widget.GridLayout#CAN_STRETCH}. -->
<enum name="canStretch" value="2" />
</attr>
<!-- A value specifying how much deficit or excess height this component can accomodate.
The default is FIXED.
See {@link android.widget.GridLayout.LayoutParams#heightSpec}.-->
<attr name="layout_heightSpec" >
<!-- If possible, height should be exactly as specified.
See {@link android.widget.GridLayout#FIXED}. -->
<enum name="fixed" value="0" />
<!-- If possible, height should be less than or equal to the specified height.
See {@link android.widget.GridLayout#CAN_SHRINK}. -->
<enum name="canShrink" value="1" />
<!-- If possible, height should be greater than or equal to the specified height.
See {@link android.widget.GridLayout#CAN_STRETCH}. -->
<enum name="canStretch" value="2" />
</attr>
</declare-styleable>
<declare-styleable name="FrameLayout_Layout">
<attr name="layout_gravity" />

View File

@@ -1738,9 +1738,11 @@
<public type="attr" name="layout_row" />
<public type="attr" name="layout_rowSpan" />
<public type="attr" name="layout_rowWeight" />
<public type="attr" name="layout_columnSpan" />
<public type="attr" name="layout_columnWeight" />
<public type="attr" name="layout_widthSpec" />
<public type="attr" name="layout_heightSpec" />
<public type="attr" name="actionModeSelectAllDrawable" />
<public type="attr" name="isAuxiliary" />

View File

@@ -66,8 +66,8 @@
<Space
android:layout_row="4"
android:layout_column="2"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_heightSpec="canStretch"
android:layout_widthSpec="canStretch"
/>
<Button

View File

@@ -97,8 +97,8 @@ public class Activity2 extends Activity {
Space v = new Space(context);
{
LayoutParams lp = new LayoutParams(row5, col3);
lp.rowWeight = 1;
lp.columnWeight = 1;
lp.widthSpec = CAN_STRETCH;
lp.heightSpec = CAN_STRETCH;
vg.addView(v, lp);
}
}