Thursday, June 30, 2011

[android-developers] Screen sizes and precise element placement.

I have a problem with supporting different screen sizes. My
application has different drawables for mdpi (320x480), hdpi (480x800)
or ldpi (240x432). I also have different layout for small, normal-
notlong, normal-long. Every size scaling or placement features are
done in dp. However my problem is that I need to precisely place an
element on the screen so it will perfectly fit to the background. One
example here is an image that I download and show inside a frame that
is part of the background. Or I also draw a circle (using drawArc) on
the top of an imageview object and need to place it precisely to fit a
'black hole' that is on that image. Because the position is dependent
on the background I place the elements with parent margins. As I wrote
I am using dp for that. However If I fit my setting for a 320x480 3"
screen and then change to 3.1" the elements are slightly misplaced and
don't fit the background. The same if I have 480x800 3.5" device but
change to 3.6" - the elements are misplaced slightly but that is
enaught to look poorly in the design. What can I do about it? I am
sure there has to be a way to achieve this on any screen size - i.e.
games must use some kind of that mechanism and they work on any screen
size. Can any one help?

PS: I have read the 'Supporting Multiple Screens' article from, so please don't paste the link. I tried to read it
carefully but if you think I must have missed sth. than feel free to
point out where is the answer to my problem on that site.

PS: I have also another question that is a little bit connected: how
to distinguish 480x800 and 480x854, or 240x400 and 240x432 to provide
different drawables for them?

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment