The Android Developer Challenge is back! Submit your idea before December 2.

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
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.

open Unit

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

open Unit

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

open String

Properties

Float

The decimal value of the percentage-based aspect ratio.

Float

The decimal value of the percentage-based bottom margin.

Float

The decimal value of the percentage-based end margin.

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 right margin.

Float

The decimal value of the percentage-based start margin.

Float

The decimal value of the percentage-based top margin.

Float

The decimal value of the percentage-based width.

Public constructors

<init>

PercentLayoutInfo()

Public methods

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

Deprecated: Use fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int) for proper RTL support.

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.

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).

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).

toString

open fun toString(): String

Properties

aspectRatio

var aspectRatio: Float

The decimal value of the percentage-based aspect ratio.

bottomMarginPercent

var bottomMarginPercent: Float

The decimal value of the percentage-based bottom margin.

endMarginPercent

var endMarginPercent: Float

The decimal value of the percentage-based end margin.

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.

rightMarginPercent

var rightMarginPercent: Float

The decimal value of the percentage-based right margin.

startMarginPercent

var startMarginPercent: Float

The decimal value of the percentage-based start margin.

topMarginPercent

var topMarginPercent: Float

The decimal value of the percentage-based top margin.

widthPercent

var widthPercent: Float

The decimal value of the percentage-based width.