PercentLayoutHelper.PercentLayoutInfo

Added in 1.0.0
Deprecated in 1.0.0

class PercentLayoutHelper.PercentLayoutInfo


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

Summary

Public constructors

Public functions

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

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

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

This function is deprecated.

Use fillMarginLayoutParams for proper RTL support.

Unit
fillMarginLayoutParams(
    view: View!,
    params: ViewGroup.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.

Unit

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

Unit

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

String!

Public 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

PercentLayoutInfo

Added in 1.0.0
Deprecated in 1.0.0
PercentLayoutInfo()

Public functions

fillLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
fun fillLayoutParams(
    params: ViewGroup.LayoutParams!,
    widthHint: Int,
    heightHint: Int
): Unit

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

fillMarginLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
fun fillMarginLayoutParams(
    params: ViewGroup.MarginLayoutParams!,
    widthHint: Int,
    heightHint: Int
): Unit

fillMarginLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
fun fillMarginLayoutParams(
    view: View!,
    params: ViewGroup.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

Added in 1.0.0
Deprecated in 1.0.0
fun restoreLayoutParams(params: ViewGroup.LayoutParams!): Unit

Restores original dimensions after they were changed for percentage based values. You should call this method only if you previously called fillLayoutParams.

restoreMarginLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
fun restoreMarginLayoutParams(params: ViewGroup.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 fillMarginLayoutParams.

toString

fun toString(): String!

Public properties

aspectRatio

Added in 1.0.0
Deprecated in 1.0.0
val aspectRatioFloat

The decimal value of the percentage-based aspect ratio.

bottomMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val bottomMarginPercentFloat

The decimal value of the percentage-based bottom margin.

endMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val endMarginPercentFloat

The decimal value of the percentage-based end margin.

heightPercent

Added in 1.0.0
Deprecated in 1.0.0
val heightPercentFloat

The decimal value of the percentage-based height.

leftMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val leftMarginPercentFloat

The decimal value of the percentage-based left margin.

rightMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val rightMarginPercentFloat

The decimal value of the percentage-based right margin.

startMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val startMarginPercentFloat

The decimal value of the percentage-based start margin.

topMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
val topMarginPercentFloat

The decimal value of the percentage-based top margin.

widthPercent

Added in 1.0.0
Deprecated in 1.0.0
val widthPercentFloat

The decimal value of the percentage-based width.