GridLayout.LayoutParams


class GridLayout.LayoutParams : ViewGroup.MarginLayoutParams


Layout information associated with each of the children of a GridLayout.

GridLayout supports both row and column spanning and arbitrary forms of alignment within each cell group. The fundamental parameters associated with each cell group are gathered into their vertical and horizontal components and stored in the rowSpec and columnSpec layout parameters. Specs are immutable structures and may be shared between the layout parameters of different children.

The row and column specs contain the leading and trailing indices along each axis and together specify the four grid indices that delimit the cells of this cell group.

The alignment properties of the row and column specs together specify both aspects of alignment within the cell group. It is also possible to specify a child's alignment within its cell group by using the setGravity method.

The weight property is also included in Spec and specifies the proportion of any excess space that is due to the associated view.

WRAP_CONTENT and MATCH_PARENT Because the default values of the width and height properties are both WRAP_CONTENT, this value never needs to be explicitly declared in the layout parameters of GridLayout's children. In addition, GridLayout does not distinguish the special size value MATCH_PARENT from WRAP_CONTENT. A component's ability to expand to the size of the parent is instead controlled by the principle of flexibility, as discussed in GridLayout. Summary You should not need to use either of the special size values: WRAP_CONTENT or MATCH_PARENT when configuring the children of a GridLayout. Default values See GridLayout for a more complete description of the conventions used by GridLayout in the interpretation of the properties of this class.

name android:row

name android:rowSpan

name android:rowWeight

name android:column

name android:columnSpan

name android:columnWeight

name android:gravity

Summary

Public constructors

Constructs a new LayoutParams with default values as defined in LayoutParams.

Copy constructor.

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

Values not defined in the attribute set take the default values defined in LayoutParams.

LayoutParams(rowSpec: GridLayout.Spec!, columnSpec: GridLayout.Spec!)

Constructs a new LayoutParams instance for this rowSpec and columnSpec.

Public functions

Boolean
equals(o: Any!)
Int
Unit
setGravity(gravity: Int)

Describes how the child views are positioned.

Protected functions

Unit
setBaseAttributes(attributes: TypedArray!, widthAttr: Int, heightAttr: Int)

Public properties

GridLayout.Spec!

The spec that defines the horizontal characteristics of the cell group described by these layout parameters.

GridLayout.Spec!

The spec that defines the vertical characteristics of the cell group described by these layout parameters.

Inherited Constants

From android.view.ViewGroup.LayoutParams
const Int

This property is deprecated.

const Int
const Int

Public constructors

LayoutParams

Added in 1.0.0
LayoutParams()

Constructs a new LayoutParams with default values as defined in LayoutParams.

LayoutParams

Added in 1.0.0
LayoutParams(params: ViewGroup.LayoutParams!)

LayoutParams

Added in 1.0.0
LayoutParams(params: ViewGroup.MarginLayoutParams!)

LayoutParams

Added in 1.0.0
LayoutParams(source: GridLayout.LayoutParams!)

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

Parameters
source: GridLayout.LayoutParams!

The layout params to copy from.

LayoutParams

Added in 1.0.0
LayoutParams(context: Context!, attrs: AttributeSet!)

Values not defined in the attribute set take the default values defined in LayoutParams.

LayoutParams

Added in 1.0.0
LayoutParams(rowSpec: GridLayout.Spec!, columnSpec: GridLayout.Spec!)

Constructs a new LayoutParams instance for this rowSpec and columnSpec. All other fields are initialized with default values as defined in LayoutParams.

Parameters
rowSpec: GridLayout.Spec!

the rowSpec

columnSpec: GridLayout.Spec!

the columnSpec

Public functions

equals

fun equals(o: Any!): Boolean

hashCode

fun hashCode(): Int

setGravity

Added in 1.0.0
fun setGravity(gravity: Int): Unit

Describes how the child views are positioned. Default is LEFT | BASELINE. See Gravity.

name android:gravity

Parameters
gravity: Int

the new gravity value

Protected functions

setBaseAttributes

protected fun setBaseAttributes(attributes: TypedArray!, widthAttr: Int, heightAttr: Int): Unit

Public properties

columnSpec

Added in 1.0.0
val columnSpecGridLayout.Spec!

The spec that defines the horizontal characteristics of the cell group described by these layout parameters. If an assignment is made to this field after a measurement or layout operation has already taken place, a call to setLayoutParams must be made to notify GridLayout of the change. GridLayout is normally able to detect when code fails to observe this rule, issue a warning and take steps to compensate for the omission. This facility is implemented on a best effort basis and should not be relied upon in production code - so it is best to include the above calls to remove the warnings as soon as it is practical.

rowSpec

Added in 1.0.0
val rowSpecGridLayout.Spec!

The spec that defines the vertical characteristics of the cell group described by these layout parameters. If an assignment is made to this field after a measurement or layout operation has already taken place, a call to setLayoutParams must be made to notify GridLayout of the change. GridLayout is normally able to detect when code fails to observe this rule, issue a warning and take steps to compensate for the omission. This facility is implemented on a best effort basis and should not be relied upon in production code - so it is best to include the above calls to remove the warnings as soon as it is practical.