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 trialKunal Patel
1,448 PointsAndroid: Different Layouts for Different Devices
Anyone know of a lesson on how to create layouts for medium phone vs. tablet displays? How to create the layout, folder naming conventions, and how Android resolves this?
I thought one exists, but I cannot seem to find it.
1 Answer
Ernest Grzybowski
Treehouse Project ReviewerThe information provided by Google is invaluable. Tons of information is available.
Definitely read through: http://developer.android.com/guide/topics/resources/providing-resources.html
and: http://developer.android.com/guide/practices/screens_support.html
As a quick little tutorial:
Try putting a completely different .xml layout into res/layout-sw600dp/
and run your application on different screen sizes.
Also, I recommend watching the Android Developers channel on youtube. This video may also help get the point across: http://www.youtube.com/watch?v=wON8StzwOLk
Also, don't think of it as creating "different layouts for different devices". It should be more of a "different layout for varying dpi and screen size."
Kunal Patel
1,448 PointsKunal Patel
1,448 PointsI just saw the youtube video, ironically they glossed over the m2Pane boolean. Any idea on how they determine this?
Ernest Grzybowski
Treehouse Project ReviewerErnest Grzybowski
Treehouse Project ReviewerIf you simply want to create a different layout, I would first read into how to provide resources for specific qualifiers. If you are interested in fragments (again, probably not the answer you want to hear), I recommend reading through the other documentation found here: http://developer.android.com/guide/components/fragments.html
Although using different layout qualifiers and using fragments should be a fairly easy lesson this is definitely not something you can teach through a discussion. This is really a fundamental part of how you go about developing/architecting your application, and shouldn't be taken lightly. Maybe the video wasn't the best example, but it was simply to show you how you can create a layout folder for different qualifier. Hope that helps!
EDIT: Just to make sure I answered your original questions.
Kunal Patel
1,448 PointsKunal Patel
1,448 PointsThank you...I've done some reading on Fragments. Ultimately I will need to figure out how to modularize my app.