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 Simple Android App Creating the Screen Layout Adding a TextView

The app's layout on my phone is not identical to the one in Android Studio.

I run the app on my Galaxy s6 edge and the "Ants stretch when they wake up in the morning." text is on top of the "Did you know?" text (They are both where the "Did you know?" should be). In Android Studio it looks perfect. does someone know what can be the problem? Thanks in advance!

Your Textview which has the "Did you know" text could have been set to be below the "Ants stretch when they wake up in the morning." TextView in your XML code. Please post your XML code here so I can check

Thank you but now I just write the XML myself because I have been told that drag and drop is deceptive. I am using linear layout so now it can not happen.

2 Answers

Jason Wiram
Jason Wiram
42,762 Points

Things may appear differently in different emulators and/or devices because the screen size, resolution, pixel density, etc may vary. The idea of setting items relative to each other in a relative layout will prevent the overlapping you mentioned. There are times when you may have to adjust the size of items, fonts, etc to make them play nice with all devices. Relative layouts are very powerful in these cases but do take some practice.

I know. the problem was no layout was declared and I understood it only after I wrote everything in linear layout and in this app we don't use any special abilities of the relative layout so I didn't change it.