Anna PS wrote:
> OK - I know what's causing the problem, but I don't know how to fix
> it. :-/
> 
> If the PNG image in the ImageView is less than 320 pixels wide (the
> width of the portrait screen), it works OK - the image aligns neatly
> with the bottom in both landscape and portrait mode.
> 
> But if it's 320 pixels wide or more, it jumps up by a centimetre in
> portrait mode.
> 
> Why don't I just resize my image to 319 pixels wide? Because then, in
> landscape mode where the screen is 480 pixels wide, it sits marooned
> in the middle of the bottom of the screen with space on either side.
> 
> How can I get round this? 

Tactically, assuming this is a drawable resource, have two.

Put your 320px edition in res/drawable under some name (e.g.,
background.png). Put your 480px edition in res/drawable-land-480x320
under the same name (e.g., background.png).

You can then refer to it as @drawable/background or
R.drawable.background and Android will choose the proper one.

Strategically, bear in mind that there will soon be a variety of screen
sizes, not just 480x320, so you may wish to rethink your UI design to
better accommodate semi-random sizing.

> I've tried a nine-patch image as a background but can't get that to
> work :(

Have you tried the image in the draw9patch tool in your SDK?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 2.0 Available!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to