PercentLayoutHelper.PercentLayoutInfo

Added in 1.0.0
Deprecated in 1.0.0

public class PercentLayoutHelper.PercentLayoutInfo


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

Summary

Public fields

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

Public methods

void
fillLayoutParams(
    ViewGroup.LayoutParams params,
    int widthHint,
    int heightHint
)

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

void
fillMarginLayoutParams(
    ViewGroup.MarginLayoutParams params,
    int widthHint,
    int heightHint
)

This method is deprecated.

Use fillMarginLayoutParams for proper RTL support.

void
fillMarginLayoutParams(
    View view,
    ViewGroup.MarginLayoutParams params,
    int widthHint,
    int heightHint
)

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.

void

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

void

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

String

Public fields

aspectRatio

Added in 1.0.0
Deprecated in 1.0.0
public float aspectRatio

The decimal value of the percentage-based aspect ratio.

bottomMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float bottomMarginPercent

The decimal value of the percentage-based bottom margin.

endMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float endMarginPercent

The decimal value of the percentage-based end margin.

heightPercent

Added in 1.0.0
Deprecated in 1.0.0
public float heightPercent

The decimal value of the percentage-based height.

leftMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float leftMarginPercent

The decimal value of the percentage-based left margin.

rightMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float rightMarginPercent

The decimal value of the percentage-based right margin.

startMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float startMarginPercent

The decimal value of the percentage-based start margin.

topMarginPercent

Added in 1.0.0
Deprecated in 1.0.0
public float topMarginPercent

The decimal value of the percentage-based top margin.

widthPercent

Added in 1.0.0
Deprecated in 1.0.0
public float widthPercent

The decimal value of the percentage-based width.

Public constructors

PercentLayoutInfo

Added in 1.0.0
Deprecated in 1.0.0
public PercentLayoutInfo()

Public methods

fillLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
public void fillLayoutParams(
    ViewGroup.LayoutParams params,
    int widthHint,
    int heightHint
)

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
public void fillMarginLayoutParams(
    ViewGroup.MarginLayoutParams params,
    int widthHint,
    int heightHint
)

fillMarginLayoutParams

Added in 1.0.0
Deprecated in 1.0.0
public void fillMarginLayoutParams(
    View view,
    ViewGroup.MarginLayoutParams params,
    int widthHint,
    int heightHint
)

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
public void restoreLayoutParams(ViewGroup.LayoutParams params)

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
public void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params)

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

public String toString()