Introduction of GridLayout.
Change-Id: Ia2ec315e7d29dcc5aa13b080fc6ce00708e9c034
This commit is contained in:
@@ -301,7 +301,9 @@ package android {
|
||||
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
|
||||
field public static final int colorForeground = 16842800; // 0x1010030
|
||||
field public static final int colorForegroundInverse = 16843270; // 0x1010206
|
||||
field public static final int columnCount = 16843633; // 0x1010371
|
||||
field public static final int columnDelay = 16843215; // 0x10101cf
|
||||
field public static final int columnOrderPreserved = 16843634; // 0x1010372
|
||||
field public static final int columnWidth = 16843031; // 0x1010117
|
||||
field public static final int completionHint = 16843122; // 0x1010172
|
||||
field public static final int completionHintView = 16843123; // 0x1010173
|
||||
@@ -575,6 +577,8 @@ 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 = 16843639; // 0x1010377
|
||||
field public static final int layout_columnWeight = 16843640; // 0x1010378
|
||||
field public static final int layout_gravity = 16842931; // 0x10100b3
|
||||
field public static final int layout_height = 16842997; // 0x10100f5
|
||||
field public static final int layout_margin = 16842998; // 0x10100f6
|
||||
@@ -582,6 +586,9 @@ package android {
|
||||
field public static final int layout_marginLeft = 16842999; // 0x10100f7
|
||||
field public static final int layout_marginRight = 16843001; // 0x10100f9
|
||||
field public static final int layout_marginTop = 16843000; // 0x10100f8
|
||||
field public static final int layout_row = 16843636; // 0x1010374
|
||||
field public static final int layout_rowSpan = 16843637; // 0x1010375
|
||||
field public static final int layout_rowWeight = 16843638; // 0x1010376
|
||||
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
|
||||
@@ -751,9 +758,11 @@ package android {
|
||||
field public static final int rotation = 16843558; // 0x1010326
|
||||
field public static final int rotationX = 16843559; // 0x1010327
|
||||
field public static final int rotationY = 16843560; // 0x1010328
|
||||
field public static final int rowCount = 16843631; // 0x101036f
|
||||
field public static final int rowDelay = 16843216; // 0x10101d0
|
||||
field public static final int rowEdgeFlags = 16843329; // 0x1010241
|
||||
field public static final int rowHeight = 16843058; // 0x1010132
|
||||
field public static final int rowOrderPreserved = 16843632; // 0x1010370
|
||||
field public static final int saveEnabled = 16842983; // 0x10100e7
|
||||
field public static final int scaleGravity = 16843262; // 0x10101fe
|
||||
field public static final int scaleHeight = 16843261; // 0x10101fd
|
||||
@@ -984,6 +993,7 @@ package android {
|
||||
field public static final int unfocusedMonthDateColor = 16843588; // 0x1010344
|
||||
field public static final int unselectedAlpha = 16843278; // 0x101020e
|
||||
field public static final int updatePeriodMillis = 16843344; // 0x1010250
|
||||
field public static final int useDefaultMargins = 16843635; // 0x1010373
|
||||
field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310
|
||||
field public static final int useLevel = 16843167; // 0x101019f
|
||||
field public static final int userVisible = 16843409; // 0x1010291
|
||||
@@ -24167,6 +24177,67 @@ package android.widget {
|
||||
ctor public Gallery.LayoutParams(android.view.ViewGroup.LayoutParams);
|
||||
}
|
||||
|
||||
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);
|
||||
method public int getColumnCount();
|
||||
method public int getOrientation();
|
||||
method public int getRowCount();
|
||||
method public boolean getUseDefaultMargins();
|
||||
method public boolean isColumnOrderPreserved();
|
||||
method public boolean isRowOrderPreserved();
|
||||
method protected void onLayout(boolean, int, int, int, int);
|
||||
method public void setColumnCount(int);
|
||||
method public void setColumnOrderPreserved(boolean);
|
||||
method public void setOrientation(int);
|
||||
method public void setRowCount(int);
|
||||
method public void setRowOrderPreserved(boolean);
|
||||
method public void setUseDefaultMargins(boolean);
|
||||
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.Alignment CENTER;
|
||||
field public static final android.widget.GridLayout.Alignment FILL;
|
||||
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;
|
||||
field public static final android.widget.GridLayout.Alignment TOP;
|
||||
field public static final int VERTICAL = 1; // 0x1
|
||||
}
|
||||
|
||||
public static abstract interface GridLayout.Alignment {
|
||||
method public abstract int getAlignmentValue(android.view.View, int);
|
||||
method public abstract int getSizeInCell(android.view.View, int, int);
|
||||
}
|
||||
|
||||
public static class GridLayout.Group {
|
||||
ctor public GridLayout.Group(android.widget.GridLayout.Interval, android.widget.GridLayout.Alignment);
|
||||
ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment);
|
||||
ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment);
|
||||
field public final android.widget.GridLayout.Alignment alignment;
|
||||
field public final android.widget.GridLayout.Interval span;
|
||||
}
|
||||
|
||||
public static class GridLayout.Interval {
|
||||
ctor public GridLayout.Interval(int, int);
|
||||
field public final int max;
|
||||
field public final int min;
|
||||
}
|
||||
|
||||
public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
|
||||
ctor public GridLayout.LayoutParams(android.widget.GridLayout.Group, android.widget.GridLayout.Group);
|
||||
ctor public GridLayout.LayoutParams();
|
||||
ctor public GridLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
|
||||
ctor public GridLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
|
||||
ctor public GridLayout.LayoutParams(android.widget.GridLayout.LayoutParams);
|
||||
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.Group rowGroup;
|
||||
field public float rowWeight;
|
||||
}
|
||||
|
||||
public class GridView extends android.widget.AbsListView {
|
||||
ctor public GridView(android.content.Context);
|
||||
ctor public GridView(android.content.Context, android.util.AttributeSet);
|
||||
@@ -25049,6 +25120,12 @@ package android.widget {
|
||||
method public abstract void onScrollStarted();
|
||||
}
|
||||
|
||||
public final class Space extends android.view.View {
|
||||
ctor public Space(android.content.Context, android.util.AttributeSet, int);
|
||||
ctor public Space(android.content.Context, android.util.AttributeSet);
|
||||
ctor public Space(android.content.Context);
|
||||
}
|
||||
|
||||
public class Spinner extends android.widget.AbsSpinner implements android.content.DialogInterface.OnClickListener {
|
||||
ctor public Spinner(android.content.Context);
|
||||
ctor public Spinner(android.content.Context, int);
|
||||
|
||||
2036
core/java/android/widget/GridLayout.java
Normal file
2036
core/java/android/widget/GridLayout.java
Normal file
File diff suppressed because it is too large
Load Diff
75
core/java/android/widget/Space.java
Normal file
75
core/java/android/widget/Space.java
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Space is a lightweight View subclass that may be used to create gaps between components
|
||||
* in general purpose layouts.
|
||||
*/
|
||||
public final class Space extends View {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw nothing.
|
||||
*
|
||||
* @param canvas an unused parameter.
|
||||
*/
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewGroup.LayoutParams getLayoutParams() {
|
||||
return super.getLayoutParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setLayoutParams(ViewGroup.LayoutParams params) {
|
||||
super.setLayoutParams(params);
|
||||
}
|
||||
}
|
||||
@@ -2429,6 +2429,36 @@
|
||||
<!-- Size of padding on either end of a divider. -->
|
||||
<attr name="dividerPadding" format="dimension" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="GridLayout">
|
||||
<!-- The orientation property is not used during layout. It is only used to
|
||||
allocate row and column prameters when they are not specified by its children's
|
||||
layout paramters. GridLayout works like LinearLayout in this case;
|
||||
putting all the components either in a single row or in a single column -
|
||||
depending on the value of this flag. In the horozintal case, a columnCount
|
||||
property may be additionally supplied to force new rows to be created when a
|
||||
row is full. The rowCount attribute may be used similarly in the vertical case.
|
||||
The default is horizontal. -->
|
||||
<attr name="orientation" />
|
||||
<!-- The maxmimum number of rows to create when automatically positioning children. -->
|
||||
<attr name="rowCount" format="integer" />
|
||||
<!-- The maxmimum number of columns to create when automatically positioning children. -->
|
||||
<attr name="columnCount" format="integer" />
|
||||
<!-- When set to true, tells GridLayout to use default margins when none are specified
|
||||
in a view's layout parameters.
|
||||
The default value is false.
|
||||
See {@link android.widget.GridLayout#setUseDefaultMargins(boolean)}.-->
|
||||
<attr name="useDefaultMargins" format="boolean" />
|
||||
<!-- When set to true, forces row boundaries to appear in the same order
|
||||
as row indices.
|
||||
The default is false.
|
||||
See {@link android.widget.GridLayout#setRowOrderPreserved(boolean)}.-->
|
||||
<attr name="rowOrderPreserved" format="boolean" />
|
||||
<!-- When set to true, forces column boundaries to appear in the same order
|
||||
as column indices.
|
||||
The default is false.
|
||||
See {@link android.widget.GridLayout#setColumnOrderPreserved(boolean)}.-->
|
||||
<attr name="columnOrderPreserved" format="boolean" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="ListView">
|
||||
<!-- Reference to an array resource that will populate the ListView. For static content,
|
||||
this is simpler than populating the ListView programmatically. -->
|
||||
@@ -3128,6 +3158,38 @@
|
||||
<attr name="layout_weight" format="float" />
|
||||
<attr name="layout_gravity" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="GridLayout_Layout">
|
||||
<!-- The row boundary delimiting the top of the group of cells
|
||||
occupied by this view. -->
|
||||
<attr name="layout_row" format="integer" />
|
||||
<!-- The row span: the difference between the bottom and top
|
||||
boundaries delimiting the group of cells occupied by this view.
|
||||
The default is one.
|
||||
See {@link android.widget.GridLayout.Group#span}. -->
|
||||
<attr name="layout_rowSpan" format="integer" min="1" />
|
||||
<!-- A number indicating the relative proportion of availible 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" />
|
||||
<!-- The column span: the difference between the right and left
|
||||
boundaries delimiting the group of cells occupied by this view.
|
||||
The default is one.
|
||||
See {@link android.widget.GridLayout.Group#span}. -->
|
||||
<attr name="layout_columnSpan" format="integer" min="1" />
|
||||
<!-- A number indicating the relative proportion of availible 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" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="FrameLayout_Layout">
|
||||
<attr name="layout_gravity" />
|
||||
</declare-styleable>
|
||||
|
||||
@@ -1672,4 +1672,17 @@
|
||||
<public type="attr" name="fullBackupAgent" />
|
||||
<public type="attr" name="suggestionsEnabled" />
|
||||
|
||||
<public type="attr" name="rowCount" />
|
||||
<public type="attr" name="rowOrderPreserved" />
|
||||
<public type="attr" name="columnCount" />
|
||||
<public type="attr" name="columnOrderPreserved" />
|
||||
<public type="attr" name="useDefaultMargins" />
|
||||
|
||||
<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" />
|
||||
|
||||
</resources>
|
||||
|
||||
26
tests/GridLayoutTest/Android.mk
Normal file
26
tests/GridLayoutTest/Android.mk
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||
|
||||
LOCAL_PACKAGE_NAME := GridLayoutTest
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
82
tests/GridLayoutTest/AndroidManifest.xml
Normal file
82
tests/GridLayoutTest/AndroidManifest.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.test.layout">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-sdk android:minSdkVersion="11"/>
|
||||
|
||||
<application>
|
||||
<activity android:name="Activity0" android:label="Activity0">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity1" android:label="Activity1">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity2" android:label="Activity2">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity3" android:label="Activity3">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity4" android:label="Activity4">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity5" android:label="Activity5">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity6" android:label="Activity6">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="Activity7" android:label="Activity7">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
||||
20
tests/GridLayoutTest/res/layout/grid0.xml
Normal file
20
tests/GridLayoutTest/res/layout/grid0.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
</GridLayout>
|
||||
77
tests/GridLayoutTest/res/layout/grid3.xml
Normal file
77
tests/GridLayoutTest/res/layout/grid3.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<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"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_row="0"
|
||||
android:layout_column="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:text="left"
|
||||
android:layout_row="1"
|
||||
android:layout_column="0"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_row="1"
|
||||
android:layout_column="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:text="right"
|
||||
android:layout_row="2"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="right"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_margin="50dip"
|
||||
android:textSize="100dip"
|
||||
android:layout_row="2"
|
||||
android:layout_column="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:text="center"
|
||||
android:layout_row="3"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_row="3"
|
||||
android:layout_column="1"
|
||||
/>
|
||||
|
||||
</GridLayout>
|
||||
34
tests/GridLayoutTest/res/layout/grid4.xml
Normal file
34
tests/GridLayoutTest/res/layout/grid4.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:text="fill"
|
||||
android:layout_margin="100dip"
|
||||
android:layout_marginLeft="100dip"
|
||||
android:layout_marginBottom="100dip"
|
||||
android:layout_marginTop="100dip"
|
||||
android:layout_marginRight="100dip"
|
||||
android:layout_row="0"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
/>
|
||||
</GridLayout>
|
||||
74
tests/GridLayoutTest/res/layout/grid5.xml
Normal file
74
tests/GridLayoutTest/res/layout/grid5.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:orientation="horizontal"
|
||||
android:columnCount="2"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:text="Name:"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:text="fill"
|
||||
android:width="200dip"
|
||||
android:height="100dip"
|
||||
android:layout_marginLeft="50dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
/>
|
||||
|
||||
<!--
|
||||
<TextView
|
||||
android:layout_row_weight="1"
|
||||
android:layout_column_weight="1"
|
||||
/>
|
||||
-->
|
||||
|
||||
<EditText
|
||||
android:text="left"
|
||||
/>
|
||||
|
||||
<EditText/>
|
||||
|
||||
<EditText
|
||||
android:text="right"
|
||||
android:layout_gravity="right"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_margin="50dip"
|
||||
android:textSize="100dip"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:text="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_height="fill_parent"
|
||||
/>
|
||||
|
||||
</GridLayout>
|
||||
39
tests/GridLayoutTest/res/layout/grid6.xml
Normal file
39
tests/GridLayoutTest/res/layout/grid6.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:columnCount="2"
|
||||
android:useDefaultMargins="true"
|
||||
>
|
||||
|
||||
<TextView android:text="Name:"/>
|
||||
|
||||
<EditText/>
|
||||
|
||||
<TextView android:text="Rank:"/>
|
||||
|
||||
<EditText/>
|
||||
|
||||
<TextView android:text="Serial Number:"/>
|
||||
|
||||
<EditText/>
|
||||
|
||||
</GridLayout>
|
||||
71
tests/GridLayoutTest/res/layout/grid7.xml
Normal file
71
tests/GridLayoutTest/res/layout/grid7.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dip" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dip"
|
||||
android:text="flabe" />
|
||||
|
||||
<Button android:id="@+id/initialActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="bax" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dip"
|
||||
android:text="bar" />
|
||||
|
||||
<EditText android:id="@+id/numberOfEvents"
|
||||
android:layout_marginLeft="2dip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/editbox_background"
|
||||
android:numeric="integer"
|
||||
android:scrollHorizontally="true"
|
||||
android:maxLines="1" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:id="@+id/start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dip"
|
||||
android:text="Foo" />
|
||||
|
||||
</GridLayout>
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity0 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.GridLayout;
|
||||
|
||||
public class Activity1 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(new GridLayout(getBaseContext()));
|
||||
}
|
||||
}
|
||||
127
tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
Normal file
127
tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import android.widget.*;
|
||||
|
||||
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||
import static android.view.inputmethod.EditorInfo.*;
|
||||
import static android.widget.GridLayout.*;
|
||||
|
||||
public class Activity2 extends Activity {
|
||||
|
||||
public static View create(Context context) {
|
||||
GridLayout vg = new GridLayout(context);
|
||||
vg.setUseDefaultMargins(true);
|
||||
|
||||
Group row1 = new Group(1, CENTER);
|
||||
Group row2 = new Group(2, CENTER);
|
||||
Group row3 = new Group(3, BASELINE);
|
||||
Group row4 = new Group(4, BASELINE);
|
||||
Group row5 = new Group(5, FILL);
|
||||
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 col1c = new Group(1, RIGHT);
|
||||
Group col2 = new Group(2, LEFT);
|
||||
Group col3 = new Group(3, FILL);
|
||||
Group col4 = new Group(4, FILL);
|
||||
|
||||
{
|
||||
TextView v = new TextView(context);
|
||||
v.setTextSize(48);
|
||||
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);
|
||||
{
|
||||
LayoutParams lp = new LayoutParams(row3, col2);
|
||||
lp.width = (int) v.getPaint().measureText("Frederick.W.Flintstone@bedrock.com ");
|
||||
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);
|
||||
{
|
||||
LayoutParams lp = new LayoutParams(row4, col2);
|
||||
lp.width = (int) v.getPaint().measureText("************");
|
||||
vg.addView(v, lp);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Space v = new Space(context);
|
||||
{
|
||||
LayoutParams lp = new LayoutParams(row5, col3);
|
||||
lp.rowWeight = 1;
|
||||
lp.columnWeight = 1;
|
||||
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");
|
||||
vg.addView(v, new LayoutParams(row7, col4));
|
||||
}
|
||||
|
||||
return vg;
|
||||
}
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(create(getBaseContext()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity3 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 20101 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity4 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity5 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity6 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid6);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.layout;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity7 extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid7);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user