Where is the documentation for Android resource XML's `<attr>` element?

Viewed 315

I was reading Ha Duy Trung's tutorial Supporting multiple themes in your Android app and in it he has the following snippet for values/attrs.xml:

<attr name="themedMenuStoryDrawable" format="reference" />
<attr name="themedMenuCommentDrawable" format="reference" />

Where is this <attr> element actually documented? Looking in the Android API Guide Providing Resources, I cannot find any mention of this type of element.

I did find a mention of <attr> elements in Creating a View Class, but there they all appear inside of <declare-styleable> elements, and there is hardly any explanation of how these elements work.

Is there proper reference documentation for the <attr> element? If not, then:

  • What does it mean to have an <attr> element directly under <resources>?
  • What is the meaning of the format attribute, and what values can it take?
  • What other XML attributes can <attr> take?
  • Can <attr> appear as the child of anything other than <resources> and <declare-styleable>?

I'd specifically like to know how to use <attr> in the context of theming (rather than custom views) though documentation of how it works in general would be even better.

0 Answers
Related