Android
android.view
public static class

android.view.ViewGroup.MarginLayoutParams

java.lang.Object
android.view.ViewGroup.LayoutParams
android.view.ViewGroup.MarginLayoutParams

Per-child layout information for layouts that support margins. See ViewGroup Margin Layout Attributes for a list of all child view attributes that this class supports.

Known Direct Subclasses
Known Indirect Subclasses

Summary

XML Attributes

Attribute name Related methods  
android:layout_marginBottom setMargins(int,int,int,int)
 
Specifies extra space on the bottom side of this view. 
android:layout_marginLeft setMargins(int,int,int,int)
 
Specifies extra space on the left side of this view. 
android:layout_marginRight setMargins(int,int,int,int)
 
Specifies extra space on the right side of this view. 
android:layout_marginTop setMargins(int,int,int,int)
 
Specifies extra space on the top side of this view. 
XML Attributes inherited from class android.view.ViewGroup.LayoutParams
Constants inherited from class android.view.ViewGroup.LayoutParams

Fields

public      int  bottomMargin  The bottom margin in pixels of the child. 
public      int  leftMargin  The left margin in pixels of the child. 
public      int  rightMargin  The right margin in pixels of the child. 
public      int  topMargin  The top margin in pixels of the child. 
Fields inherited from class android.view.ViewGroup.LayoutParams

Public Constructors

            ViewGroup.MarginLayoutParams(Context c, AttributeSet attrs)
Creates a new set of layout parameters.
            ViewGroup.MarginLayoutParams(int width, int height)
            ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams source)
Copy constructor.
            ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams source)

Public Methods

          void  setMargins(int left, int top, int right, int bottom)
Sets the margins, in pixels.
Methods inherited from class android.view.ViewGroup.LayoutParams
Methods inherited from class java.lang.Object

Details

XML Attributes

android:layout_marginBottom

Specifies extra space on the bottom side of this view. This space is outside this view's bounds.

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol layout_marginBottom.

Related Methods

android:layout_marginLeft

Specifies extra space on the left side of this view. This space is outside this view's bounds.

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol layout_marginLeft.

Related Methods

android:layout_marginRight

Specifies extra space on the right side of this view. This space is outside this view's bounds.

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol layout_marginRight.

Related Methods

android:layout_marginTop

Specifies extra space on the top side of this view. This space is outside this view's bounds.

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol layout_marginTop.

Related Methods

Fields

public int bottomMargin

The bottom margin in pixels of the child.

public int leftMargin

The left margin in pixels of the child.

public int rightMargin

The right margin in pixels of the child.

public int topMargin

The top margin in pixels of the child.

Public Constructors

public ViewGroup.MarginLayoutParams(Context c, AttributeSet attrs)

Creates a new set of layout parameters. The values are extracted from the supplied attributes set and context.

Parameters

c the application environment
attrs the set of attributes from which to extract the layout parameters' values

public ViewGroup.MarginLayoutParams(int width, int height)

public ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams source)

Copy constructor. Clones the width, height and margin values of the source.

Parameters

source The layout params to copy from.

public ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams source)

Public Methods

public void setMargins(int left, int top, int right, int bottom)

Sets the margins, in pixels.

Parameters

left the left margin size
top the top margin size
right the right margin size
bottom the bottom margin size
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56