Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Can someone explain the "include" bit as I couldn't see how it linked two .xml files, or what it actually linked across?
I am most confused on the how to apply it and what it actually does as he only actually talks about it for about 10 seconds. The ordering confused me, but what I make of it is that the "activity_song_playback.xml" now includes all of the styling and xml code from the playback_controls.xml file?
Beginner but also very curious
Boban Talevski24,793 Points
The include thing seems to not be related to styles and themes as he points out, so I wouldn't bother with understanding the part about how themes and styles behave along with include tags (at least I didn't so far). And you seem to have it figured out mostly as it's just what you are saying:
At the spot of the include tag in activity_song_playback.xml, imagine copy pasting the contents of the playback_controls.xml file and there you have it. The include is just saying at this spot, use the code in the layout file I'm pointing to with the first line
The way I see it, It's a feature to keep the code a bit more organized and prevent code duplication if you need to use those same playback controls in another layout. So instead of copy pasting the whole content of playback_controls.xml in multiple layout files, you just make use of the include tag to add it each time.