Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Design

Bob Boursaw
Bob Boursaw
2,047 Points

Content_main vs. Activity_main is opposite from training videos, or I'm missing something

I have noticed that in the videos, when Ben requests we open up the activity_main.xml to work with the relative layout, I am not able to perform any of the actions requested as I do not have the options called out unless I bring up my content_main.xml.

If I open up activity_main.xml and then look in my component tree, there is no reference to relative layout whatsoever. I see...

Custom View... -- Custom View... ----include...

If I open up activity_main.xml, I then see relative layout in my component tree and can perform all of the steps that are shown in the video.

I have also noticed that I cannot drag any new components out on to the activity_main layout and must switch to the content_main.xml in order to do so.

I do not know if this is a difference in version from when the videos were created to now or if there is something fundemental that I am missing but do know, that I can only add new elements to a layout or change properties of elements in a layout if I have the content_main layout in play and not the activity_main.

If anyone could help clear this up for me, I would greatly appreciate it.

Thank you!

Bob

Zachary Fine
Zachary Fine
10,110 Points

Hey Bob!! Make sure you label your question correctly. I am assuming this is an Android question.

I too have recently started the Android track and I noticed myself the content_main.xml, which Ben does not have in his video. This is because content_main.xml is a new part of Android 1.4 and above. According to new design pattern in android studio activity_main.xml will determine how the look of the main activity should be. While content_main.xml will determine the contents in the activity_main.xml.

All in all I wouldn't worry about it too much. When you see Ben add a button, text_field, or any other content just do the same in the content_main.xml

GOOD LUCK!!!

1 Answer

Bob Boursaw
Bob Boursaw
2,047 Points

Thank you for the info Zachary!

Much appreciated.