public static class StyleParser.ScalarValue extends Object
| Constructor and Description |
|---|
ScalarValue() |
ScalarValue(double value,
byte unit)
Creates a new scalar value given magnitude and unit.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getPixelValue()
Gets the magnitude of this scalar value in pixels.
|
byte |
getUnit() |
double |
getValue() |
void |
setUnit(byte unit) |
void |
setValue(double value) |
String |
toString()
Returns the scalar value in CN1 style string format.
|
String |
toString(int decimalPlaces)
Formats this scalar value (including units) but rounding to the given number
of decimal places.
|
public ScalarValue(double value,
byte unit)
value - The value to set.unit - The unit of the value. One of StyleParser.UNIT_INHERIT, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_PIXELS, or Style.UNIT_TYPE_SCREEN_PERCENTAGE.public ScalarValue()
public byte getUnit()
StyleParser.UNIT_INHERIT, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_PIXELS, or Style.UNIT_TYPE_SCREEN_PERCENTAGE.public void setUnit(byte unit)
unit - the unit of the value. One of StyleParser.UNIT_INHERIT, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_PIXELS, or Style.UNIT_TYPE_SCREEN_PERCENTAGE.public double getValue()
public void setValue(double value)
value - the value of the scalar.public String toString()
public String toString(int decimalPlaces)
decimalPlaces - public int getPixelValue()