androidx.core.content.res


Classes

ConfigurationHelper

Helper class which allows access to properties of Configuration in a backward compatible fashion.

ResourcesCompat

Helper for accessing features in Resources.

ResourcesCompat.FontCallback

Interface used to receive asynchronous font fetching events.

ResourcesCompat.ThemeCompat

Provides backward-compatible implementations for new Theme APIs.

Extension functions summary

Boolean

Retrieve the boolean value for the attribute at index or throws IllegalArgumentException if not defined.

@ColorInt Int

Retrieve the color value for the attribute at index or throws IllegalArgumentException if not defined.

ColorStateList

Retrieve the color state list value for the attribute at index or throws IllegalArgumentException if not defined.

Float

Retrieve the dimension value for the attribute at index or throws IllegalArgumentException if not defined.

@Dimension Int

Retrieve the dimension pixel offset value for the attribute at index or throws IllegalArgumentException if not defined.

@Dimension Int

Retrieve the dimension pixel size value for the attribute at index or throws IllegalArgumentException if not defined.

Drawable

Retrieve the drawable value for the attribute at index or throws IllegalArgumentException if not defined.

Float

Retrieve the float value for the attribute at index or throws IllegalArgumentException if not defined.

Typeface

Retrieve the font value for the attribute at index or throws IllegalArgumentException if not defined.

Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

@AnyRes Int

Retrieves the resource identifier for the attribute at index or throws IllegalArgumentException if not defined.

String

Retrieve the string value for the attribute at index or throws IllegalArgumentException if not defined.

Array<CharSequence>

Retrieve the text array value for the attribute at index or throws IllegalArgumentException if not defined.

CharSequence

Retrieve the text value for the attribute at index or throws IllegalArgumentException if not defined.

inline R
<R : Any?> TypedArray.use(block: (TypedArray) -> R)

Executes the given block function on this TypedArray and then recycles it.

Extension functions

getBooleanOrThrow

fun TypedArray.getBooleanOrThrow(index: @StyleableRes Int): Boolean

Retrieve the boolean value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getBoolean

getColorOrThrow

fun TypedArray.getColorOrThrow(index: @StyleableRes Int): @ColorInt Int

Retrieve the color value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getColor

getColorStateListOrThrow

fun TypedArray.getColorStateListOrThrow(index: @StyleableRes Int): ColorStateList

Retrieve the color state list value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionOrThrow

fun TypedArray.getDimensionOrThrow(index: @StyleableRes Int): Float

Retrieve the dimension value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelOffsetOrThrow

fun TypedArray.getDimensionPixelOffsetOrThrow(index: @StyleableRes Int): @Dimension Int

Retrieve the dimension pixel offset value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelSizeOrThrow

fun TypedArray.getDimensionPixelSizeOrThrow(index: @StyleableRes Int): @Dimension Int

Retrieve the dimension pixel size value for the attribute at index or throws IllegalArgumentException if not defined.

getDrawableOrThrow

fun TypedArray.getDrawableOrThrow(index: @StyleableRes Int): Drawable

Retrieve the drawable value for the attribute at index or throws IllegalArgumentException if not defined.

getFloatOrThrow

fun TypedArray.getFloatOrThrow(index: @StyleableRes Int): Float

Retrieve the float value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getFloat

getFontOrThrow

@RequiresApi(value = 26)
fun TypedArray.getFontOrThrow(index: @StyleableRes Int): Typeface

Retrieve the font value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getFont

getIntOrThrow

fun TypedArray.getIntOrThrow(index: @StyleableRes Int): Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getInt

getIntegerOrThrow

fun TypedArray.getIntegerOrThrow(index: @StyleableRes Int): Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getInteger

getResourceIdOrThrow

fun TypedArray.getResourceIdOrThrow(index: @StyleableRes Int): @AnyRes Int

Retrieves the resource identifier for the attribute at index or throws IllegalArgumentException if not defined.

getStringOrThrow

fun TypedArray.getStringOrThrow(index: @StyleableRes Int): String

Retrieve the string value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getString

getTextArrayOrThrow

fun TypedArray.getTextArrayOrThrow(index: @StyleableRes Int): Array<CharSequence>

Retrieve the text array value for the attribute at index or throws IllegalArgumentException if not defined.

getTextOrThrow

fun TypedArray.getTextOrThrow(index: @StyleableRes Int): CharSequence

Retrieve the text value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getText

use

inline fun <R : Any?> TypedArray.use(block: (TypedArray) -> R): R

Executes the given block function on this TypedArray and then recycles it.

See also
use