@Retention(value = RetentionPolicy.SOURCE)
@Target(value = ElementType.METHOD)
public 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 = )
public annotation Attribute.IntMap

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

Public methods

abstract @NonNull Attribute.IntMap[]

Map semantic names to int values.

abstract @NonNull String

The full name of the attribute, including namespace.

Public methods

intMapping

Added in 1.0.0
public abstract @NonNull Attribute.IntMap[] intMapping()

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
@NonNull Attribute.IntMap[]

an array of map entries

value

Added in 1.0.0
public abstract @NonNull String value()

The full name of the attribute, including namespace.

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

Returns
@NonNull String

the attribute name