PercentLayoutInfo

open class PercentLayoutInfo
kotlin.Any
   ↳ androidx.percentlayout.widget.PercentLayoutHelper.PercentLayoutInfo

Container for information about percentage dimensions and margins. It acts as an extension for LayoutParams.

Summary

Public constructors

Public methods
open Unit

Restores original dimensions after they were changed for percentage based values.

open String

open Unit

Restores the original dimensions and margins after they were changed for percentage based values.

open Unit
fillLayoutParams(params: LayoutParams!, widthHint: Int, heightHint: Int)

Fills the ViewGroup.LayoutParams#width and ViewGroup.LayoutParams#height fields of the passed ViewGroup.LayoutParams object based on currently set percentage values.

open Unit
fillMarginLayoutParams(params: MarginLayoutParams!, widthHint: Int, heightHint: Int)

open Unit
fillMarginLayoutParams(view: View!, params: MarginLayoutParams!, widthHint: Int, heightHint: Int)

Fills the margin fields of the passed ViewGroup.MarginLayoutParams object based on currently set percentage values and the current layout direction of the passed View.

Properties
Float

The decimal value of the percentage-based width.

Float

The decimal value of the percentage-based height.

Float

The decimal value of the percentage-based left margin.

Float

The decimal value of the percentage-based top margin.

Float

The decimal value of the percentage-based right margin.

Float

The decimal value of the percentage-based bottom margin.

Float

The decimal value of the percentage-based start margin.

Float

The decimal value of the percentage-based end margin.

Float

The decimal value of the percentage-based aspect ratio.

Public constructors

<init>

PercentLayoutInfo()

Public methods

restoreLayoutParams

open fun restoreLayoutParams(params: LayoutParams!): Unit

Restores original dimensions after they were changed for percentage based values. You should call this method only if you previously called PercentLayoutHelper.PercentLayoutInfo#fillLayoutParams(ViewGroup.LayoutParams, int, int).

toString

open fun toString(): String

restoreMarginLayoutParams

open fun restoreMarginLayoutParams(params: MarginLayoutParams!): Unit

Restores the original dimensions and margins after they were changed for percentage based values. You should call this method only if you previously called PercentLayoutHelper.PercentLayoutInfo#fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int).

fillLayoutParams

open fun fillLayoutParams(params: LayoutParams!, widthHint: Int, heightHint: Int): Unit

Fills the ViewGroup.LayoutParams#width and ViewGroup.LayoutParams#height fields of the passed ViewGroup.LayoutParams object based on currently set percentage values.

fillMarginLayoutParams

open fun fillMarginLayoutParams(params: MarginLayoutParams!, widthHint: Int, heightHint: Int): Unit

fillMarginLayoutParams

open fun fillMarginLayoutParams(view: View!, params: MarginLayoutParams!, widthHint: Int, heightHint: Int): Unit

Fills the margin fields of the passed ViewGroup.MarginLayoutParams object based on currently set percentage values and the current layout direction of the passed View.

Properties

widthPercent

var widthPercent: Float

The decimal value of the percentage-based width.

heightPercent

var heightPercent: Float

The decimal value of the percentage-based height.

leftMarginPercent

var leftMarginPercent: Float

The decimal value of the percentage-based left margin.

topMarginPercent

var topMarginPercent: Float

The decimal value of the percentage-based top margin.

rightMarginPercent

var rightMarginPercent: Float

The decimal value of the percentage-based right margin.

bottomMarginPercent

var bottomMarginPercent: Float

The decimal value of the percentage-based bottom margin.

startMarginPercent

var startMarginPercent: Float

The decimal value of the percentage-based start margin.

endMarginPercent

var endMarginPercent: Float

The decimal value of the percentage-based end margin.

aspectRatio

var aspectRatio: Float

The decimal value of the percentage-based aspect ratio.