Reputation: 7266
I am building a simple Android app, but I am having trouble getting the layout to look OK on both the Galaxy S (480x800) and the Galaxy S3 (720x1280). Here's how it's looks right now on the S (which is how I want it to look):
And on the S3:
As you can see there are two things wrong: the top margin is not enough on the S3, and the buttons are too small after the re-sizing. I am using "dp" everywhere though.
I believe both screens are considered "normal" size, so creating a "layout-large" folder where I could tweak the margins wouldn't work, right?
The only other option I can think about is to create IFs on my code checking for specific phone models, and adjusting the margin value accordingly. Would this work, or is there a better way?
Thanks
Upvotes: 0
Views: 558
Reputation: 763
Its not just about using dp. Your going to want to use multiple techniques that android offers to achieve screen independence.
So if I were creating this layout I would do the following. Use a RelativeLayout as the parent view. Add the logo/header to the top with some dp as padding for top and center horizontally. Add a linear layout with a draw 9 background version of the box, inside the linear layout i would add the three buttons. Then either below that or align with the bottom of the RelativeLayout i would add questions button.
Below are a bunch of links to how to use some of these tools.
Relative Layout http://developer.android.com/guide/topics/ui/layout/relative.html
Draw Nine's http://developer.android.com/tools/help/draw9patch.html
Linear Layout http://developer.android.com/guide/topics/ui/layout/linear.html
Edit as t0mm13b above pointed out this is also a good link to read. http://developer.android.com/guide/practices/screens_support.html
Upvotes: 1