0

I'm having a trouble here on hot to make my background image fit on a high resolution screen. It works just fine in a 4" screen but image won't stretch out when I deployed it on a larger screen. I tried to search for an answer but nothing helps as of now. well this might be a problem with my xml code but I'm not really sure. My design works with 1 table layout and 2 table rows for the 2 objects. And on the LinearLayout I set my background image.

For further understanding I made a sample on how it looks like when deployed.

There you go. It works fine on my phone while It doesn't occupy the whole space in Galaxy tab. Also as much as possible I would like to make my background image in smaller size around 320x480 pixel is size and just stretch it out.

KaHeL
  • 4,301
  • 16
  • 54
  • 78

3 Answers3

1

Set your layout height and width to FILL_PARENT?

Haedrian
  • 4,240
  • 2
  • 32
  • 53
  • I'm not really sure If I've already tried this one. I will reply to this one once I made a retest. Thanks! By the way, what's the difference between fill_parent and match_parent? – KaHeL Nov 12 '11 at 13:47
  • http://stackoverflow.com/questions/5761960/what-is-the-difference-between-match-parent-and-fill-parent-property-in-android Apparently its to do with padding. – Haedrian Nov 12 '11 at 13:55
  • Hi, I've tested your solution for this one and well still it doesn't work. – KaHeL Nov 15 '11 at 04:25
  • Also here's the xml code: is there's something wrong with this? – KaHeL Nov 15 '11 at 04:31
0

Its clear that you did not set Layout_height and Layout_width to fill_parent .

also for better rending put images in all three drawable folders drawable-mdpi, drawable-ldpi,drawable-hdpi .

also make your background image as 9patch will be nice for resizing a backgrond .

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40
0

Well there are so many reasons I could point out for this problem of yours.

1)First thing the first screen shows a mobile screen and the next one shows a tab avd.

2)The image what u have should be in size to fit a mobile of particular resolutions only.

So your only hope is to get a image with resolution that fits the tab.

Or to change the wrap content to fill parent for your width and height.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • I have my image resolution of 1280x1924 for the background graphic. I believe this is more than what a tab resolution needed but still the same problem occurs. On the other hand, using this resolution also force closes my application on phone with lower memory you can see the error logs in one of my question. – KaHeL Nov 15 '11 at 04:29
  • E/AndroidRuntime(12927): Caused by: java.lang.OutOfMemoryError:bitmap size exceeds VM budget. see detailed log here: http://stackoverflow.com/questions/7962696/android-application-force-closes-after-adding-sql-lite-codes – KaHeL Nov 16 '11 at 04:16