How to use declare-styleable
This article mainly shows you "how to use declare-styleable", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use declare-styleable" this article.
Declare-styleable:declare-styleable is used to add custom properties to custom controls.
Declarestyleable writes attrs.xml first.
You can create a resource file attrs.xml or customize a resource file xx.xml under the res-vlaues folder.
Then configure declare-styleable,name as PersonAttr in it
Declarestyleable code
[html] viewplaincopy
View the code chip derived from my code chip on CODE
Here I set the name name, gender sex, age age, and feature attribute weight (three attributes within fat,mid,thin and their corresponding attribute values), as well as whether or not the adult adult, and the font size textView of TextView.
Maybe someone here will ask what format is and what the words in it mean.
Format is the format, which is the format corresponding to this attribute. The approximate format listed below is:
The above is all the contents of this article "how to use declare-styleable". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!