Annotation Interface StyleableRes


Denotes that a string array or integer parameter, field or method return value is expected to be a styleable resource declaration.

When a string array is denoted, then the array contains (namespace, attribute) pairs of declared attributes, and must be grouped by namespace, sorted by namespace, and then by attribute name in lexicographic order.
When an integer is denoted, then it represents the index of attribute pair in the string array, ranged from 0 (inclusive) to array.length / 2 (exclusive).

Example:


  // 5 attributes
  @StyleableRes
  static final String[] STYLEABLE = {
    "framework", "color", // index 0
    "framework", "size",  // index 1
    "framework", "text",  // ...
    "library", "color",
    "library", "shape",   // index 4
  };
  {
      TypedArray a = theme.obtainStyledAttributes(R.style.MyStyle, STYLEABLE);
      int value = a.getDimensionPixelSize(1, -1); // get "framework:attr/size"
      a.recycle();
  }