|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.RelativeLayout
public class RelativeLayout
A Layout where the positions of the children can be described in relation to each other or to the parent. For the sake of efficiency, the relations between views are evaluated in one pass, so if view Y is dependent on the position of view X, make sure the view X comes first in the layout.
Note that you cannot have a circular dependency between the size of the RelativeLayout and the
position of its children. For example, you cannot have a RelativeLayout whose height is set to
WRAP_CONTENT and a child set to
ALIGN_PARENT_BOTTOM.
Also see RelativeLayout.LayoutParams for
layout attributes
| Nested Class Summary | |
|---|---|
static class |
RelativeLayout.LayoutParams
Per-child layout information associated with RelativeLayout. |
| Nested classes/interfaces inherited from class android.view.ViewGroup |
|---|
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary | |
|---|---|
static int |
ABOVE
Rule that aligns a child's bottom edge with another child's top edge. |
static int |
ALIGN_BASELINE
Rule that aligns a child's baseline with another child's baseline. |
static int |
ALIGN_BOTTOM
Rule that aligns a child's bottom edge with another child's bottom edge. |
static int |
ALIGN_LEFT
Rule that aligns a child's left edge with another child's left edge. |
static int |
ALIGN_PARENT_BOTTOM
Rule that aligns the child's bottom edge with its RelativeLayout parent's bottom edge. |
static int |
ALIGN_PARENT_LEFT
Rule that aligns the child's left edge with its RelativeLayout parent's left edge. |
static int |
ALIGN_PARENT_RIGHT
Rule that aligns the child's right edge with its RelativeLayout parent's right edge. |
static int |
ALIGN_PARENT_TOP
Rule that aligns the child's top edge with its RelativeLayout parent's top edge. |
static int |
ALIGN_RIGHT
Rule that aligns a child's right edge with another child's right edge. |
static int |
ALIGN_TOP
Rule that aligns a child's top edge with another child's top edge. |
static int |
BELOW
Rule that aligns a child's top edge with another child's bottom edge. |
static int |
CENTER_HORIZONTAL
Rule that centers the child horizontally with respect to the bounds of its RelativeLayout parent. |
static int |
CENTER_IN_PARENT
Rule that centers the child with respect to the bounds of its RelativeLayout parent. |
static int |
CENTER_VERTICAL
Rule that centers the child vertically with respect to the bounds of its RelativeLayout parent. |
static int |
LEFT_OF
Rule that aligns a child's right edge with another child's left edge. |
static int |
RIGHT_OF
Rule that aligns a child's left edge with another child's right edge. |
static int |
TRUE
|
| Constructor Summary | |
|---|---|
RelativeLayout(Context context)
|
|
RelativeLayout(Context context,
AttributeSet attrs)
|
|
RelativeLayout(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams()
Returns a set of layout parameters with a width of ViewGroup.LayoutParams.WRAP_CONTENT,
a height of ViewGroup.LayoutParams.WRAP_CONTENT and no spanning. |
RelativeLayout.LayoutParams |
generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set. |
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params. |
int |
getBaseline()
Return the offset of the widget's text baseline from the widget's top boundary. |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
Called from layout when this view should assign a size and position to each of its children. |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the measured height. |
void |
setGravity(int gravity)
Describes how the child views are positioned. |
void |
setHorizontalGravity(int horizontalGravity)
|
void |
setIgnoreGravity(int viewId)
Defines which View is ignored when the gravity is applied. |
void |
setVerticalGravity(int verticalGravity)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, isLayoutRequested, requestLayout |
| Field Detail |
|---|
public static final int TRUE
public static final int LEFT_OF
public static final int RIGHT_OF
public static final int ABOVE
public static final int BELOW
public static final int ALIGN_BASELINE
public static final int ALIGN_LEFT
public static final int ALIGN_TOP
public static final int ALIGN_RIGHT
public static final int ALIGN_BOTTOM
public static final int ALIGN_PARENT_LEFT
public static final int ALIGN_PARENT_TOP
public static final int ALIGN_PARENT_RIGHT
public static final int ALIGN_PARENT_BOTTOM
public static final int CENTER_IN_PARENT
public static final int CENTER_HORIZONTAL
public static final int CENTER_VERTICAL
| Constructor Detail |
|---|
public RelativeLayout(Context context)
public RelativeLayout(Context context,
AttributeSet attrs)
public RelativeLayout(Context context,
AttributeSet attrs,
int defStyle)
| Method Detail |
|---|
public void setIgnoreGravity(int viewId)
Gravity.LEFT | Gravity.TOP.
viewId - The id of the View to be ignored by gravity, or 0 if no View
should be ignored.setGravity(int)public void setGravity(int gravity)
Gravity.LEFT | Gravity.TOP.
gravity - See GravitysetHorizontalGravity(int),
setVerticalGravity(int)public void setHorizontalGravity(int horizontalGravity)
public void setVerticalGravity(int verticalGravity)
public int getBaseline()
ViewReturn the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.
getBaseline in class View
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
View
Measure the view and its content to determine the measured width and the
measured height. This method is invoked by View.measure(int, int) and
should be overriden by subclasses to provide accurate and efficient
measurement of their contents.
CONTRACT: When overriding this method, you
must call View.setMeasuredDimension(int, int) to store the
measured width and height of this view. Failure to do so will trigger an
IllegalStateException, thrown by
View.measure(int, int). Calling the superclass'
View.onMeasure(int, int) is a valid use.
The base class implementation of measure defaults to the background size,
unless a larger size is allowed by the MeasureSpec. Subclasses should
override View.onMeasure(int, int) to provide better measurements of
their content.
If this method is overridden, it is the subclass's responsibility to make
sure the measured height and width are at least the view's minimum height
and width (View.getSuggestedMinimumHeight() and
View.getSuggestedMinimumWidth()).
onMeasure in class ViewwidthMeasureSpec - horizontal space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.heightMeasureSpec - vertical space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.View.getMeasuredWidth(),
View.getMeasuredHeight(),
View.setMeasuredDimension(int, int),
View.getSuggestedMinimumHeight(),
View.getSuggestedMinimumWidth(),
View.MeasureSpec.getMode(int),
View.MeasureSpec.getSize(int)
protected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
ViewGroup
onLayout in class ViewGroupchanged - This is a new size or position for this viewl - Left position, relative to parentt - Top position, relative to parentr - Right position, relative to parentb - Bottom position, relative to parentpublic RelativeLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
ViewGroup
generateLayoutParams in class ViewGroupattrs - the attributes to build the layout parameters from
ViewGroup.LayoutParams or one
of its descendantsprotected ViewGroup.LayoutParams generateDefaultLayoutParams()
ViewGroup.LayoutParams.WRAP_CONTENT,
a height of ViewGroup.LayoutParams.WRAP_CONTENT and no spanning.
generateDefaultLayoutParams in class ViewGroupprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
ViewGroup
checkLayoutParams in class ViewGroupprotected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
ViewGroupViewGroup.checkLayoutParams(android.view.ViewGroup.LayoutParams), this method
is invoked. This method should return a new set of layout params suitable for
this ViewGroup, possibly by copying the appropriate attributes from the
specified set of layout params.
generateLayoutParams in class ViewGroupp - The layout parameters to convert into a suitable set of layout parameters
for this ViewGroup.
ViewGroup.LayoutParams or one
of its descendants
|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||