Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

LayoutParams

open class LayoutParams : LayoutParams
kotlin.Any
   ↳ android.view.ViewGroup.LayoutParams
   ↳ android.view.ViewGroup.MarginLayoutParams
   ↳ android.widget.FrameLayout.LayoutParams
   ↳ androidx.wear.widget.BoxInsetLayout.LayoutParams

Per-child layout information for layouts that support margins, gravity and boxedEdges. See R.styleable#BoxInsetLayout_Layout for a list of all child view attributes that this class supports. R.attr#Layout_boxedEdges

Summary

Constants

static Int

The view will force an inset on all of the edges of the children.

static Int

The view will force an inset on the bottom edge of the children.

static Int

The view will force an inset on the left edge of the children.

static Int

Default boxing setting.

static Int

The view will force an inset on the right edge of the children.

static Int

The view will force an inset on the top edge of the children.

Public constructors

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?)

Creates a new set of layout parameters.

<init>(width: Int, height: Int)

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

<init>(width: Int, height: Int, gravity: Int)

Creates a new set of layout parameters with the specified width, height and gravity.

<init>(width: Int, height: Int, gravity: Int, boxed: Int)

<init>(@NonNull source: LayoutParams)

Copy constructor.

<init>(@NonNull source: MarginLayoutParams)

Copy constructor.

<init>(@NonNull source: LayoutParams)

Copy constructor.

Copy constructor.

Properties

Int

Specifies the screen-specific insets for each of the child edges.

Constants

BOX_ALL

static val BOX_ALL: Int

The view will force an inset on all of the edges of the children.

Value: 0x0F

BOX_BOTTOM

static val BOX_BOTTOM: Int

The view will force an inset on the bottom edge of the children.

Value: 0x08

BOX_LEFT

static val BOX_LEFT: Int

The view will force an inset on the left edge of the children.

Value: 0x01

BOX_NONE

static val BOX_NONE: Int

Default boxing setting. There are no insets forced on the child views.

Value: 0x0

BOX_RIGHT

static val BOX_RIGHT: Int

The view will force an inset on the right edge of the children.

Value: 0x04

BOX_TOP

static val BOX_TOP: Int

The view will force an inset on the top edge of the children.

Value: 0x02

Public constructors

<init>

LayoutParams(@NonNull context: Context, @Nullable attrs: AttributeSet?)

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

Parameters
context Context: the application environment
attrs Context: the set of attributes from which to extract the layout parameters' values

<init>

LayoutParams(width: Int, height: Int)

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

Parameters
width Int: the width, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixels
height Int: the height, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixelsy

<init>

LayoutParams(width: Int, height: Int, gravity: Int)

Creates a new set of layout parameters with the specified width, height and gravity.

Parameters
width Int: the width, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixels
height Int: the height, either MATCH_PARENT, WRAP_CONTENT or a fixed size in pixels
gravity Int: the gravity

<init>

LayoutParams(width: Int, height: Int, gravity: Int, boxed: Int)

<init>

LayoutParams(@NonNull source: LayoutParams)

Copy constructor. Clones the width and height of the source.

Parameters
source LayoutParams: The layout params to copy from.

<init>

LayoutParams(@NonNull source: MarginLayoutParams)

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

Parameters
source MarginLayoutParams: The layout params to copy from.

<init>

LayoutParams(@NonNull source: LayoutParams)

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

Parameters
source LayoutParams: The layout params to copy from.

<init>

LayoutParams(@NonNull source: BoxInsetLayout.LayoutParams)

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

Parameters
source BoxInsetLayout.LayoutParams: The layout params to copy from.

Properties

boxedEdges

var boxedEdges: Int

Specifies the screen-specific insets for each of the child edges.