Android Programming: The Big Nerd Ranch Guide, 2nd Edition
by Bill Phillips, Chris Stewart, Brian Hardy, Kristin Marsicano
For the More Curious: Using Includes
In this chapter, you used an include so that you would not have to repeat a large portion of your layout file across both landscape and portrait orientations. From that example, you can see how includes can be handy: they reduce typing and they help you follow the Don’t Repeat Yourself principle. But that does not mean that you should use them every time you have common layout items in landscape and portrait.
First, a detail about how includes work.
In this chapter, you used an include tag without any android attributes.
When you do that, the view you include gets all of the attributes it had in its original layout file.
However, you do not have to limit yourself to this. You can also add additional ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access