Android
android.widget
public class

android.widget.AbsoluteLayout

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.ViewGroup ViewManager ViewParent
android.widget.AbsoluteLayout

A layout that lets you specify exact locations (x/y coordinates) of its children. Absolute layouts are less flexible and harder to maintain than other types of layouts without absolute positioning.

XML attributes

See ViewGroup Attributes, View Attributes

Nested Classes
AbsoluteLayout.LayoutParams Per-child layout information associated with AbsoluteLayout. 
Known Direct Subclasses

Summary

XML Attributes inherited from class android.view.ViewGroup
XML Attributes inherited from class android.view.View
Constants inherited from class android.view.ViewGroup
Constants inherited from class android.view.View
Fields inherited from class android.view.ViewGroup
Fields inherited from class android.view.View

Public Constructors

            AbsoluteLayout(Context context)
            AbsoluteLayout(Context context, AttributeSet attrs)
            AbsoluteLayout(Context context, AttributeSet attrs, int defStyle)

Public Methods

          ViewGroup.LayoutParams  generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set.

Protected Methods

          boolean  checkLayoutParams(ViewGroup.LayoutParams p)
          ViewGroup.LayoutParams  generateDefaultLayoutParams()
Returns a set of layout parameters with a width of WRAP_CONTENT, a height of WRAP_CONTENT and with the coordinates (0, 0).
          ViewGroup.LayoutParams  generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params.
          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.
          void  onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

Methods inherited from class android.view.ViewGroup
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.ViewManager
Methods inherited from interface android.view.ViewParent

Details

Public Constructors

public AbsoluteLayout(Context context)

public AbsoluteLayout(Context context, AttributeSet attrs)

public AbsoluteLayout(Context context, AttributeSet attrs, int defStyle)

Public Methods

public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)

Returns a new set of layout parameters based on the supplied attributes set.

Parameters

attrs the attributes to build the layout parameters from

Returns

Protected Methods

protected boolean checkLayoutParams(ViewGroup.LayoutParams p)

protected ViewGroup.LayoutParams generateDefaultLayoutParams()

Returns a set of layout parameters with a width of WRAP_CONTENT, a height of WRAP_CONTENT and with the coordinates (0, 0).

Returns

  • a set of default layout parameters or null

protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)

Returns a safe set of layout parameters based on the supplied layout params. When a ViewGroup is passed a View whose layout params do not pass the test of 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.

Parameters

p The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.

Returns

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. Derived classes with children should override this method and call layout on each of their their children.

Parameters

changed This is a new size or position for this view
l Left position, relative to parent
t Top position, relative to parent
r Right position, relative to parent
b Bottom position, relative to parent

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height. This method is invoked by 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 setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' 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 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 (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Parameters

widthMeasureSpec 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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56