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

I read the Ha Duy Trung tutorial Supporting multiple themes in your Android application , and in it it has the following snippet for values/attrs.xml :

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

Where is this <attr> element really documented? In the Android API Resource Allocation Guide, I cannot find mention of this type of element.

I found mention of the <attr> elements in Creating a view class , but there they all appear inside the <declare-styleable> elements, and there is hardly any explanation of how these elements work.

Is there any help documentation for the <attr> element? If not, then:

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

I would like to know how to use <attr> in the context of the topic (and not in user views), although the documentation on how it works in general will be even better.

+5
source share

Source: https://habr.com/ru/post/1270123/


All Articles