@Retention(value = RetentionPolicy.SOURCE)
@Target(value = ElementType.METHOD)
annotation Attribute


Map a getter to its Android resources attribute.

This annotation is consumed by the androidx.resourceinspection:resourceinspection-processor annotation processor to map a getter on a custom android.view.View back to its XML attribute name and ID. This enables Android Studio's layout inspection tool to read the runtime values of the attributes of a custom android.view.View.

Summary

Nested types

@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
annotation Attribute.IntMap

One entry in a mapping of int values to enum or flag names.

Public functions

abstract Array<Attribute.IntMap!>

Map semantic names to int values.

abstract String

The full name of the attribute, including namespace.

Public functions

intMapping

Added in 1.0.0
abstract fun intMapping(): Array<Attribute.IntMap!>

Map semantic names to int values.

Populating this field with an array of IntMap entries provides the layout inspection tool with the semantic names of enumerations stored as integers, instead of the numeric value. This is used for attributes with an androidx.annotation.IntDef mapping to flags or enumerations.

By default, the annotation processor assumes that the mapping defines an enumeration. If any one of the entries has its mask set, the mapping will be interpreted as flags.

Returns
Array<Attribute.IntMap!>

an array of map entries

value

Added in 1.0.0
abstract fun value(): String

The full name of the attribute, including namespace.

For example: "android:color" or "my.library:myAttribute".

Returns
String

the attribute name