AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
10/31/12 07:29 AM (13 years ago)

Android background images

I've been building an app and linking the background images for my button menu to a URL They are jpg files, large is 1600x1600, small is 1200x1200, centred to look OK portrait and landscape - so far, so good. Now I am building the images into the project, so I put them into res/drawable folder and they came out way too big. I found that by putting them in res/drawable-xhdpi and they were OK again my old Android phone. The question is, is this enough?. Should I be creating other sizes too and if so, where would they go, or will Android scale things down for lower resolution devices?
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
10/31/12 08:45 AM (13 years ago)
Sure you can set fit to screen in properties. Then it will fit any device screen.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
10/31/12 08:49 AM (13 years ago)
In the menu advanced setting, under background image, you can choose full screen or full screen preserve ratio. You should be able to put the images in the res>drawable folder and apply one or other of those settings and it <i>should</i> be ok..
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
10/31/12 08:59 AM (13 years ago)
Thanks @Mr Stuck, tried that, but the photo distorts on rotation if I do that, there wasn't a happy compromise that I could find. The trouble here for me is that with Android is that not only do you not know the screen resolutions to expect, you also do not know the aspect ratio and even if you did, Android would stretch it in a way that I can't easily predict if you use full size (with or without preserve ratio). In this case, the background photo is a photo and to avoid distortion and allow for rotation, I told android not to stretch - centring the image seems to work best. @raveyd, thanks too, that is pretty much where I have ended up since I started the post. The thing that made me wonder if I am on the right track is when I dropped the image into different res/drawable folders I had different results for how much of the photo is shown. What I am hoping is that by putting the files in the highest resolution folder is that Android will handle dealing with lower resolution devices.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
10/31/12 09:03 AM (13 years ago)
Maybe you could send out apk for some of us to test? Perhaps some feedback would help you decide best options
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
10/31/12 09:11 AM (13 years ago)
I use multiples of 320x480 if that helps? Never SEEN a problem, but that doesn't mean there're no problems out there! 640x960 looks fine on large tablets. I usually find a much larger hi-res image and use editing software to scale it down and preserve the resolution.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
10/31/12 10:28 AM (13 years ago)
Thanks for thanks for the support, I think I haven't described the problem very well. The issue is about where to move the images into Eclipse. When I linked my backgrounds by URL (e.g. http://mydomain.com/ background.jpg and http://mydomain.com/ background_l.jpg), all was good. Putting my image into /res/drawable/background.jpg gave a poor result (too big for the screen), but when I moved it to /res/drawable-xhdpi/background.jpg was OK. I guess I just want to understand when to put a images in drawable-xhdpi and drawable-mdpi and drawble-ldpi etc etc.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
10/31/12 11:36 AM (13 years ago)
For sure learning the Low, med, hi and xtra density folders is key. I've posted this before, this article explains it really well. http://coding.smashingmagazine.com/2011/06/30/designing-for-android/ another good one here too that's more current. http://mobile.smashingmagazine.com/2012/07/26/android-design-tips/
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
11/01/12 02:51 AM (13 years ago)
Thanks to everyone so far for the help and advice. I have done some reading and done some testing and I am beginning to believe that the issue is understanding Buzztouch behavior first and Android behavior second. And my issue here is specifically about the small device and large device background images for a button menu. I have created AVD simulators ranging from 320x240, 480x320 and higher resolutions. I have re-created a low resolution version of my background image as 320x320 pixels and put them in my res/drawable folder. So now I have two sets of two background images. I found that Buzztouch is only looking in res/drawable-xhdpi for the button menu background images. So my conclusion is that once Buzztouch finds the images to use for small devices and large devices, there is no further searching across the alternative res/drawable folders (ldpi, mdpi etc) to match the device resolution. Is that it or have I got the wrong end of the stick?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.