Jelly
Jelly

Reputation: 4522

Android layout alternative resources

I have an issue with android layouts. I have different values for dimensions (in dp) for each screen size category small, normal, large, xlarge used in my layout, but for some reason my layout still looks way bigger on galaxy s2 compared with xperia s although they both have 4.3 inches. Shouldn't android take care automatically of that? Am I missing something? I think using sw will add too much overhead since I'd have many values-sw folders.

Upvotes: 0

Views: 93

Answers (3)

Romit Nahar
Romit Nahar

Reputation: 1

You should use the unit "sp" over "dp" this will help your view elements to automatically resize as per the screen size and resolution.

Upvotes: 0

Jelly
Jelly

Reputation: 4522

It turns out that its not such a big difference (it looked that way because textviews don't split the words at the end of the line) after all, but still there is about 20dp extra space in xperia s width. Which I think its normal for android since the docs say:

normal screens are at least 470dp x 320dp

Upvotes: 0

rupesh jain
rupesh jain

Reputation: 3430

Have you used sp units for font size for text if yes check the user's font size preferences Is it same on both the devices..you may also need to put resources in different resolution bucket too-mdpi,hdpi,xhdpi..I feel different resolution on both the devices might be causing the issue(I know you have used "dp" but still can try...)

Upvotes: 1

Related Questions