public static class PercentLayoutHelper.PercentLayoutInfo extends Object
LayoutParams
.Modifier and Type | Field and Description |
---|---|
float |
aspectRatio
The decimal value of the percentage-based aspect ratio.
|
float |
bottomMarginPercent
The decimal value of the percentage-based bottom margin.
|
float |
endMarginPercent
The decimal value of the percentage-based end margin.
|
float |
heightPercent
The decimal value of the percentage-based height.
|
float |
leftMarginPercent
The decimal value of the percentage-based left margin.
|
float |
rightMarginPercent
The decimal value of the percentage-based right margin.
|
float |
startMarginPercent
The decimal value of the percentage-based start margin.
|
float |
topMarginPercent
The decimal value of the percentage-based top margin.
|
float |
widthPercent
The decimal value of the percentage-based width.
|
Constructor and Description |
---|
PercentLayoutInfo() |
Modifier and Type | Method and Description |
---|---|
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(ViewGroup.MarginLayoutParams params,
int widthHint,
int heightHint)
Deprecated.
Use
fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int)
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 |
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.
|
public float widthPercent
public float heightPercent
public float leftMarginPercent
public float topMarginPercent
public float rightMarginPercent
public float bottomMarginPercent
public float startMarginPercent
public float endMarginPercent
public float aspectRatio
public void fillLayoutParams(ViewGroup.LayoutParams params, int widthHint, int heightHint)
ViewGroup.LayoutParams#width
and ViewGroup.LayoutParams#height
fields of the passed ViewGroup.LayoutParams
object based on currently set
percentage values.@Deprecated public void fillMarginLayoutParams(ViewGroup.MarginLayoutParams params, int widthHint, int heightHint)
fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int)
for proper RTL support.public void fillMarginLayoutParams(View view, ViewGroup.MarginLayoutParams params, int widthHint, int heightHint)
ViewGroup.MarginLayoutParams
object based
on currently set percentage values and the current layout direction of the passed
View
.public String toString()
Object
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())
public void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params)
fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int)
.public void restoreLayoutParams(ViewGroup.LayoutParams params)
fillLayoutParams(ViewGroup.LayoutParams, int, int)
.