Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.percentlayout:percentlayout:1.0.0-rc01
Deprecated since version 1.0.0

PercentLayoutHelper.PercentLayoutInfo

public static class PercentLayoutHelper.PercentLayoutInfo
extends Object

java.lang.Object
   ↳ androidx.percentlayout.widget.PercentLayoutHelper.PercentLayoutInfo


This class was deprecated in API level 1.0.0.
use ConstraintLayout and Guidelines for layout support.

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

Summary

Fields

public float aspectRatio

The decimal value of the percentage-based aspect ratio.

public float bottomMarginPercent

The decimal value of the percentage-based bottom margin.

public float endMarginPercent

The decimal value of the percentage-based end margin.

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 rightMarginPercent

The decimal value of the percentage-based right margin.

public float startMarginPercent

The decimal value of the percentage-based start margin.

public float topMarginPercent

The decimal value of the percentage-based top margin.

public float widthPercent

The decimal value of the percentage-based width.

Public constructors

PercentLayoutHelper.PercentLayoutInfo()

Public methods

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

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

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

This method was deprecated in API level 1.0.0. Use fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int) for proper RTL support.

void restoreLayoutParams(ViewGroup.LayoutParams params)

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

void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params)

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

String toString()

Inherited methods

Fields

aspectRatio

added in version 1.0.0
public float aspectRatio

The decimal value of the percentage-based aspect ratio.

bottomMarginPercent

added in version 1.0.0
public float bottomMarginPercent

The decimal value of the percentage-based bottom margin.

endMarginPercent

added in version 1.0.0
public float endMarginPercent

The decimal value of the percentage-based end margin.

heightPercent

added in version 1.0.0
public float heightPercent

The decimal value of the percentage-based height.

leftMarginPercent

added in version 1.0.0
public float leftMarginPercent

The decimal value of the percentage-based left margin.

rightMarginPercent

added in version 1.0.0
public float rightMarginPercent

The decimal value of the percentage-based right margin.

startMarginPercent

added in version 1.0.0
public float startMarginPercent

The decimal value of the percentage-based start margin.

topMarginPercent

added in version 1.0.0
public float topMarginPercent

The decimal value of the percentage-based top margin.

widthPercent

added in version 1.0.0
public float widthPercent

The decimal value of the percentage-based width.

Public constructors

PercentLayoutHelper.PercentLayoutInfo

added in version 1.0.0
public PercentLayoutHelper.PercentLayoutInfo ()

Public methods

fillLayoutParams

added in version 1.0.0
public void fillLayoutParams (ViewGroup.LayoutParams params, 
                int widthHint, 
                int heightHint)

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

Parameters
params ViewGroup.LayoutParams

widthHint int

heightHint int

fillMarginLayoutParams

added in version 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.

Parameters
view View

params ViewGroup.MarginLayoutParams

widthHint int

heightHint int

fillMarginLayoutParams

added in version 1.0.0
public void fillMarginLayoutParams (ViewGroup.MarginLayoutParams params, 
                int widthHint, 
                int heightHint)

This method was deprecated in API level 1.0.0.
Use fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int) for proper RTL support.

Parameters
params ViewGroup.MarginLayoutParams

widthHint int

heightHint int

restoreLayoutParams

added in version 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(ViewGroup.LayoutParams, int, int).

Parameters
params ViewGroup.LayoutParams

restoreMarginLayoutParams

added in version 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(View, ViewGroup.MarginLayoutParams, int, int).

Parameters
params ViewGroup.MarginLayoutParams

toString

public String toString ()

Returns
String