Added in API level 1

TypedValue


open class TypedValue
kotlin.Any
   ↳ android.util.TypedValue

Container for a dynamically typed data value. Primarily used with android.content.res.Resources for holding resource values.

Summary

Constants
static Int

Complex data: mask to extract mantissa information (after shifting by COMPLEX_MANTISSA_SHIFT).

static Int

Complex data: bit location of mantissa information.

static Int

Complex data: the mantissa magnitude is 0 bits -- i.

static Int

Complex data: the mantissa magnitude is 16 bits -- i.

static Int

Complex data: the mantissa is an integral number -- i.

static Int

Complex data: the mantissa magnitude is 8 bits -- i.

static Int

Complex data: mask to extract radix information (after shifting by COMPLEX_RADIX_SHIFT).

static Int

Complex data: where the radix information is, telling where the decimal place appears in the mantissa.

static Int

TYPE_DIMENSION complex unit: Value is Device Independent Pixels.

static Int

TYPE_FRACTION complex unit: A basic fraction of the overall size.

static Int

TYPE_FRACTION complex unit: A fraction of the parent size.

static Int

TYPE_DIMENSION complex unit: Value is in inches.

static Int

Complex data: mask to extract unit information (after shifting by COMPLEX_UNIT_SHIFT).

static Int

TYPE_DIMENSION complex unit: Value is in millimeters.

static Int

TYPE_DIMENSION complex unit: Value is in points.

static Int

TYPE_DIMENSION complex unit: Value is raw pixels.

static Int

Complex data: bit location of unit information.

static Int

TYPE_DIMENSION complex unit: Value is a scaled pixel.

static Int

TYPE_NULL data indicating the value was explicitly set to null.

static Int

TYPE_NULL data indicating the value was not specified.

static Int

If density is equal to this value, then the density should be treated as the system's default density value: DisplayMetrics.DENSITY_DEFAULT.

static Int

If density is equal to this value, then there is no density associated with the resource and it should not be scaled.

static Int

The data field holds an attribute resource identifier (referencing an attribute in the current theme style, not a resource entry).

static Int

The data field holds a complex number encoding a dimension value.

static Int

Identifies the start of integer values that were specified as color constants (starting with '#').

static Int

Identifies the start of plain integer values.

static Int

The data field holds an IEEE 754 floating point number.

static Int

The data field holds a complex number encoding a fraction of a container.

static Int

data holds 0 to represent false, or a value different from 0 to represent true.

static Int

The data field holds a color that was originally specified as #argb.

static Int

The data field holds a color that was originally specified as #aarrggbb.

static Int

The data field holds a color that was originally specified as #rgb.

static Int

The data field holds a color that was originally specified as #rrggbb.

static Int

The data field holds a number that was originally specified in decimal.

static Int

The data field holds a number that was originally specified in hexadecimal (0xn).

static Int

Identifies the end of integer values that were specified as color constants.

static Int

Identifies the end of plain integer values.

static Int

The value contains no data.

static Int

The data field holds a resource identifier.

static Int

The string field holds string data.

Public constructors

Public methods
open static Float
applyDimension(unit: Int, value: Float, metrics: DisplayMetrics!)

Converts an unpacked complex data value holding a dimension to its final floating point pixel value.

CharSequence!

Regardless of the actual type of the value, try to convert it to a string value.

static String!
coerceToString(type: Int, data: Int)

Perform type conversion as per coerceToString() on an explicitly supplied type and data.

open static Float

Converts a complex data value holding a dimension to its final floating point value.

open static Int

Converts a complex data value holding a dimension to its final value as an integer pixel offset.

open static Int

Converts a complex data value holding a dimension to its final value as an integer pixel size.

open static Float
complexToFloat(complex: Int)

Retrieve the base value from a complex data integer.

open static Float
complexToFraction(data: Int, base: Float, pbase: Float)

Converts a complex data value holding a fraction to its final floating point value.

open static Float
convertDimensionToPixels(unitToConvertFrom: Int, value: Float, metrics: DisplayMetrics)

Converts a dimension value to raw pixels, e.

open static Float
convertPixelsToDimension(unitToConvertTo: Int, pixelValue: Float, metrics: DisplayMetrics)

Converts a pixel value to the given dimension, e.

open static Float
deriveDimension(unitToConvertTo: Int, pixelValue: Float, metrics: DisplayMetrics)

Converts a pixel value to the given dimension, e.

open Int

Return the complex unit type for this value.

open Float

Return the data for this value as a dimension.

Float

Return the data for this value as a float.

open Float
getFraction(base: Float, pbase: Float)

Return the data for this value as a fraction.

open Boolean

Determine if a value is a color.

open Unit
setTo(other: TypedValue!)

open String

Returns a string representation of the object.

Properties
Int

Additional information about where the value came from; only set for strings.

Int

If the value came from a resource, these are the configurations for which its contents can change.

Int

Basic data in the value, interpreted according to type

Int

If the Value came from a resource, this holds the corresponding pixel density.

Int

If Value came from a resource, this holds the corresponding resource id.

Int

If the Value came from a style resource or a layout resource (set in an XML layout), this holds the corresponding style or layout resource id against which the attribute was resolved.

CharSequence!

If the value holds a string, this is it.

Int

The type held by this value, as defined by the constants here.

Constants

COMPLEX_MANTISSA_MASK

Added in API level 1
static val COMPLEX_MANTISSA_MASK: Int

Complex data: mask to extract mantissa information (after shifting by COMPLEX_MANTISSA_SHIFT). This gives us 23 bits of precision; the top bit is the sign.

Value: 16777215

COMPLEX_MANTISSA_SHIFT

Added in API level 1
static val COMPLEX_MANTISSA_SHIFT: Int

Complex data: bit location of mantissa information.

Value: 8

COMPLEX_RADIX_0p23

Added in API level 1
static val COMPLEX_RADIX_0p23: Int

Complex data: the mantissa magnitude is 0 bits -- i.e, 0x0.nnnnnn

Value: 3

COMPLEX_RADIX_16p7

Added in API level 1
static val COMPLEX_RADIX_16p7: Int

Complex data: the mantissa magnitude is 16 bits -- i.e, 0xnnnn.nn

Value: 1

COMPLEX_RADIX_23p0

Added in API level 1
static val COMPLEX_RADIX_23p0: Int

Complex data: the mantissa is an integral number -- i.e., 0xnnnnnn.0

Value: 0

COMPLEX_RADIX_8p15

Added in API level 1
static val COMPLEX_RADIX_8p15: Int

Complex data: the mantissa magnitude is 8 bits -- i.e, 0xnn.nnnn

Value: 2

COMPLEX_RADIX_MASK

Added in API level 1
static val COMPLEX_RADIX_MASK: Int

Complex data: mask to extract radix information (after shifting by COMPLEX_RADIX_SHIFT). This give us 4 possible fixed point representations as defined below.

Value: 3

COMPLEX_RADIX_SHIFT

Added in API level 1
static val COMPLEX_RADIX_SHIFT: Int

Complex data: where the radix information is, telling where the decimal place appears in the mantissa.

Value: 4

COMPLEX_UNIT_DIP

Added in API level 1
static val COMPLEX_UNIT_DIP: Int

TYPE_DIMENSION complex unit: Value is Device Independent Pixels.

Value: 1

COMPLEX_UNIT_FRACTION

Added in API level 1
static val COMPLEX_UNIT_FRACTION: Int

TYPE_FRACTION complex unit: A basic fraction of the overall size.

Value: 0

COMPLEX_UNIT_FRACTION_PARENT

Added in API level 1
static val COMPLEX_UNIT_FRACTION_PARENT: Int

TYPE_FRACTION complex unit: A fraction of the parent size.

Value: 1

COMPLEX_UNIT_IN

Added in API level 1
static val COMPLEX_UNIT_IN: Int

TYPE_DIMENSION complex unit: Value is in inches.

Value: 4

COMPLEX_UNIT_MASK

Added in API level 1
static val COMPLEX_UNIT_MASK: Int

Complex data: mask to extract unit information (after shifting by COMPLEX_UNIT_SHIFT). This gives us 16 possible types, as defined below.

Value: 15

COMPLEX_UNIT_MM

Added in API level 1
static val COMPLEX_UNIT_MM: Int

TYPE_DIMENSION complex unit: Value is in millimeters.

Value: 5

COMPLEX_UNIT_PT

Added in API level 1
static val COMPLEX_UNIT_PT: Int

TYPE_DIMENSION complex unit: Value is in points.

Value: 3

COMPLEX_UNIT_PX

Added in API level 1
static val COMPLEX_UNIT_PX: Int

TYPE_DIMENSION complex unit: Value is raw pixels.

Value: 0

COMPLEX_UNIT_SHIFT

Added in API level 1
static val COMPLEX_UNIT_SHIFT: Int

Complex data: bit location of unit information.

Value: 0

COMPLEX_UNIT_SP

Added in API level 1
static val COMPLEX_UNIT_SP: Int

TYPE_DIMENSION complex unit: Value is a scaled pixel