has been working on custom controls for Android recently.
for example, when you customize the navigation bar, you can:
- first define a navigation item containing pictures and text After
- , use the package name in the main navigate view, set each item attribute, do namespaces, and so on.
the include layout is not used here.
secondly, I read this tutorial and tried to copy a common top (title bar) layout:
Android development-load a common layout (such as a common title bar) , this can also be developed in the form of custom controls, but this is not done here (set using the typedarray structure and defining the attrs property), but inside:
- include layout is used The
- Java file doesn"t involve more logic, just init.
in what scenarios can I use include in a custom control? And custom controls?
are there any repetitions of these two usage scenarios?
it is currently known that include can be xml multiplexed in the same layout, and the same layout is also switched when switching, but if you put it in the main view, other layouts attached to it will be messed up.
the current project requirement is to try the above tutorial according to the switching setting of different text in the main view, but it cannot be realized. Currently, we are using typedarray structure and defining attrs property to set it in "custom control", and then write logic)
attach a link to my notes:
Whisperbird-her Bay-Android Learning Notes-compound controls