Most visited

Recently visited

PercentLayoutHelper.PercentLayoutInfo

public static class PercentLayoutHelper.PercentLayoutInfo
extends Object

java.lang.Object
   ↳ android.support.percent.PercentLayoutHelper.PercentLayoutInfo


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 width and 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 is deprecated. 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()

Returns a string representation of the object.

Inherited methods

From class java.lang.Object

Fields

aspectRatio

float aspectRatio

The decimal value of the percentage-based aspect ratio.

bottomMarginPercent

float bottomMarginPercent

The decimal value of the percentage-based bottom margin.

endMarginPercent

float endMarginPercent

The decimal value of the percentage-based end margin.

heightPercent

float heightPercent

The decimal value of the percentage-based height.

leftMarginPercent

float leftMarginPercent

The decimal value of the percentage-based left margin.

rightMarginPercent

float rightMarginPercent

The decimal value of the percentage-based right margin.

startMarginPercent

float startMarginPercent

The decimal value of the percentage-based start margin.

topMarginPercent

float topMarginPercent

The decimal value of the percentage-based top margin.

widthPercent

float widthPercent

The decimal value of the percentage-based width.

Public constructors

PercentLayoutHelper.PercentLayoutInfo

PercentLayoutHelper.PercentLayoutInfo ()

Public methods

fillLayoutParams

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.

Parameters
params ViewGroup.LayoutParams
widthHint int
heightHint int

fillMarginLayoutParams

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

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

This method is deprecated.
Use fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int) for proper RTL support.

Parameters
params ViewGroup.MarginLayoutParams
widthHint int
heightHint int

restoreLayoutParams

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

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

String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

Hooray!