public class

PercentLayoutHelper.PercentLayoutInfo

extends java.lang.Object

 java.lang.Object

↳androidx.percentlayout.widget.PercentLayoutHelper.PercentLayoutInfo

Overview

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

Summary

Fields
public floataspectRatio

The decimal value of the percentage-based aspect ratio.

public floatbottomMarginPercent

The decimal value of the percentage-based bottom margin.

public floatendMarginPercent

The decimal value of the percentage-based end margin.

public floatheightPercent

The decimal value of the percentage-based height.

public floatleftMarginPercent

The decimal value of the percentage-based left margin.

public floatrightMarginPercent

The decimal value of the percentage-based right margin.

public floatstartMarginPercent

The decimal value of the percentage-based start margin.

public floattopMarginPercent

The decimal value of the percentage-based top margin.

public floatwidthPercent

The decimal value of the percentage-based width.

Constructors
publicPercentLayoutInfo()

Methods
public voidfillLayoutParams(ViewGroup.LayoutParams params, int widthHint, int heightHint)

Fills the and fields of the passed object based on currently set percentage values.

public voidfillMarginLayoutParams(ViewGroup.MarginLayoutParams params, int widthHint, int heightHint)

public voidfillMarginLayoutParams(View view, ViewGroup.MarginLayoutParams params, int widthHint, int heightHint)

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

public voidrestoreLayoutParams(ViewGroup.LayoutParams params)

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

public voidrestoreMarginLayoutParams(ViewGroup.MarginLayoutParams params)

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

public java.lang.StringtoString()

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public float widthPercent

The decimal value of the percentage-based width.

public float heightPercent

The decimal value of the percentage-based height.

public float leftMarginPercent

The decimal value of the percentage-based left margin.

public float topMarginPercent

The decimal value of the percentage-based top margin.

public float rightMarginPercent

The decimal value of the percentage-based right margin.

public float bottomMarginPercent

The decimal value of the percentage-based bottom margin.

public float startMarginPercent

The decimal value of the percentage-based start margin.

public float endMarginPercent

The decimal value of the percentage-based end margin.

public float aspectRatio

The decimal value of the percentage-based aspect ratio.

Constructors

public PercentLayoutInfo()

Methods

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

Fills the and fields of the passed object based on currently set percentage values.

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

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

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

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

public java.lang.String toString()

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 PercentLayoutHelper.PercentLayoutInfo.fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int).

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 PercentLayoutHelper.PercentLayoutInfo.fillLayoutParams(ViewGroup.LayoutParams, int, int).