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

Android

Graphical Layout Element Alignment

Yes I am a really big NOOB,

I started a blank layout and drag-n-droped my textField passwordField and a Button into the layout. However the layout would only let me drop these elements into the top left corner and won't allow me to align them anywhere else. I don't know XML enough to even search google for the answer. Is there a fix action I can implement on my graphical editor or do I need to resolve this in the XML? If that's a case please point me to a resource cheat sheet.

2 Answers

Well I figured this out I think but it may have created another issue.

So I'm working on the "Self Destruct Messaging App" and created a LoginActivity and two "xml" files were created. 1) activity_login.xml and 2) fragment_login.xml. I found that I could edit in the graphical editor with the fragment but not in the activity as Ben was demonstrating. grrrrrrr!

So after I did everything Ben demonstrated but doing so instead in the fragment_login.xml everything worked.

Well that is until I wrote the "OnClickLIstener" code for the "signupText".... Arg my brain is melting.

YUP – same here. I think when you continue using the fragment.xml files all the code needs to go under the OnCreate of 'fragments' and not OnCreate 'Activity'.