Material Attributes
Utility methods to work with attributes.
Functions
Link copied to clipboard
Returns the TypedValue for the provided
attributeResId or null if the attribute is not present in the current theme.Link copied to clipboard
open fun resolveBoolean(@NonNull context: Context, @AttrRes attributeResId: Int, defaultValue: Boolean): Boolean
open fun resolveBoolean(@NonNull theme: Resources.Theme, @AttrRes attributeResId: Int, defaultValue: Boolean): Boolean
Returns the boolean value for the provided
attributeResId or defaultValue if the attribute is not a boolean or not present in the current theme.Link copied to clipboard
Link copied to clipboard
@Px
Returns the pixel value of the dimension specified by
attributeResId.open fun resolveDimension(@NonNull theme: Resources.Theme, @AttrRes attributeResId: Int, defaultValue: Float): Float
Returns the pixel value of the dimension specified by
attributeResId or null if attributeResId cannot be found or is not a dimension in the given theme.Link copied to clipboard
open fun resolveInteger(@NonNull context: Context, @AttrRes attributeResId: Int, defaultValue: Int): Int
open fun resolveInteger(@NonNull theme: Resources.Theme, @AttrRes attributeResId: Int, defaultValue: Int): Int
Returns the integer value for the provided
attributeResId or defaultValue if the attribute is not a integer or not present in the current theme.Link copied to clipboard
Returns the minimum touch target size, acceptable for accessibility, in pixels.
Link copied to clipboard
Returns the TypedValue for the provided
attributeResId, using the context of the provided componentView.open fun resolveOrThrow(@NonNull context: Context, @AttrRes attributeResId: Int, @NonNull errorMessageComponent: String): Int
Returns the TypedValue for the provided
attributeResId.Link copied to clipboard
open fun resolveTypedValueOrThrow(@NonNull componentView: View, @AttrRes attributeResId: Int): TypedValue
open fun resolveTypedValueOrThrow(@NonNull context: Context, @AttrRes attributeResId: Int, @NonNull errorMessageComponent: String): TypedValue