How to add documentation to custom attributes? How to add documentation to custom attributes? xml xml

How to add documentation to custom attributes?


Add XML comment to every element:

<?xml version="1.0" encoding="utf-8"?><resources>    <declare-styleable name="SomeViewsCustomAttrs">        <!-- Default highlight color for items that are pressed. -->        <attr name="colorPressedHighlight" format="color" />        <!-- Default highlight color for items that are long-pressed. -->        <attr name="colorLongPressedHighlight" format="color" />    </declare-styleable></resources> 

And in the Java Doc in the Java source file of your view link to the attributes like this (example from TextView):

* See {@link android.R.styleable#TextView TextView Attributes}, {@link android.R.styleable#View View Attributes}


You need to write constructors in code and then link them to the xml. Read this for more info.