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 Build a Self-Destructing Message Android App Starting the App Adding the Login Screen

MORESH KOKANE
MORESH KOKANE
8,097 Points

Unable to position fields and buttons on the login layout file

I am feeling a bit silly but the activity_login.xml file is acting funny on me. I am able to add text and password fields as well as the button. But all of them are getting locked at the top of the layout file and are now overlapping each other.

I tried moving it around but it wont move, it does resize but the position is locked. Not sure how to tackle this ? Help !

7 Answers

Hi - I would recommend working only in the XML code for this one. If you are stuck, you could pull the source code from the right side of the video and take a look at how everything is formatted using xml.

MORESH KOKANE
MORESH KOKANE
8,097 Points

Go to graphical layout of your xml file, in the outline tab right click on the outline and select change layout. You will find the required option there. Cheers !

MORESH KOKANE
MORESH KOKANE
8,097 Points

While this obviously did work, the problem was I was in a different layout. I changed the layout to relative layout and things were much better. Cheers !

Akshay Shivpuri
Akshay Shivpuri
2,917 Points

How did you changed the layout to Relative one? I am also facing similar issue.

Akshay Shivpuri
Akshay Shivpuri
2,917 Points

Thanks moresh for the reply. Also, while running the app in my phone, "Hello World" is coming and it's partly overlapping the "Username " text written. Could you help me with it?

Akshay Shivpuri
Akshay Shivpuri
2,917 Points

Fixed it. The solution was itself in the forums. Treehouse rocks! :D

Armen Nalband
Armen Nalband
4,685 Points

Adding answer because had same problem but no sufficient answer on forum:

Clear anything you might have placed. From the graphical layout view, go to Layouts, drag onto the screen a Relative Layout Make the relative layout fit the whole screen by stretching width and height

Now drag on your elements (Plain text field and Password text field for the Ribbit app)