Android Guides | Samples

Android.Views.ViewGroup.LayoutParams Class

LayoutParams are used by views to tell their parents how they want to be laid out.

See Also: ViewGroup+LayoutParams

Syntax

[Android.Runtime.Register("android/view/ViewGroup$LayoutParams", DoNotGenerateAcw=true)]
public class ViewGroup.LayoutParams : Object

Remarks

LayoutParams are used by views to tell their parents how they want to be laid out. See NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#ViewGroup_Layout for a list of all child view attributes that this class supports.

Developer Guides

The base LayoutParams class just describes how big the view wants to be for both width and height. For each dimension, it can specify one of:

  • FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)
  • WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding)
  • an exact number
There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.

For more information about creating user interface layouts, read the XML Layouts developer guide.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.ViewGroup.LayoutParams are listed below.

See Also: Object

Public Constructors

Copy constructor.
Creates a new set of layout parameters.
Creates a new set of layout parameters with the specified width and height.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
FillParentInt32 (-1). Special value for the height or width requested by a View.
const
MatchParentInt32 (-1). Special value for the height or width requested by a View.
const
WrapContentInt32 (-2). Special value for the height or width requested by a View.

Public Properties

HeightInt32. Information about how tall the view wants to be.
LayoutAnimationParametersLayoutAnimationController+AnimationParameters. Used to animate layouts.
WidthInt32. Information about how wide the view wants to be.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

ResolveLayoutDirection(LayoutDirection)
Resolve layout parameters depending on the layout direction.

Protected Methods

SetBaseAttributes(TypedArray, Int32, Int32)
Extracts the layout parameters from the supplied attributes.