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 : MarginLayoutParams
kotlin.Any
   ↳ android.view.ViewGroup.LayoutParams
   ↳ android.view.ViewGroup.MarginLayoutParams
   ↳ androidx.appcompat.widget.LinearLayoutCompat.LayoutParams

Per-child layout information associated with ViewLinearLayout.

Summary

Public constructors

<init>(c: Context!, attrs: AttributeSet!)

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

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

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

Copy constructor.

Properties

Int

Gravity for the view associated with these LayoutParams.

Float

Indicates how much of the extra space in the LinearLayout will be allocated to the view associated with these LayoutParams.

Public constructors

<init>

LayoutParams(c: Context!, attrs: AttributeSet!)

<init>

LayoutParams(width: Int, height: Int)

<init>

LayoutParams(width: Int, height: Int, weight: Float)

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

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
weight Int: the weight

<init>

LayoutParams(p: LayoutParams!)

<init>

LayoutParams(source: MarginLayoutParams!)

<init>

LayoutParams(source: LinearLayoutCompat.LayoutParams!)

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

Parameters
source LinearLayoutCompat.LayoutParams!: The layout params to copy from.

Properties

gravity

var gravity: Int

Gravity for the view associated with these LayoutParams.

weight

var weight: Float

Indicates how much of the extra space in the LinearLayout will be allocated to the view associated with these LayoutParams. Specify 0 if the view should not be stretched. Otherwise the extra pixels will be pro-rated among all views whose weight is greater than 0.