Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android image sizes

Im getting started with android development and i have a few questions about supporting different screen sizes. I have read all about it here but still dont get how to use different sized images for different screens. My situation is that I have put an image in res/drawable/hdpi which will be picked up when running on my samsung infuse 4g as well as on my galaxy 10.1 tablet. Because they have the same density class the image will have roughly the same physical size on both devices. And this is the problem, obviously I want the image to be way bigger on my tablet but I have yet not found a way to do this.

I did look at another classification whith small, medium and large but that seemed only to be applicable to layouts and not image resources.

Any pointers would be appreciated.

Thanks!

like image 716
danca Avatar asked Dec 04 '11 00:12

danca


People also ask

What size should Android images be?

36x36 (0.75x) for low-density (ldpi) 48x48 (1.0x baseline) for medium-density (mdpi) 72x72 (1.5x) for high-density (hdpi) 96x96 (2.0x) for extra-high-density (xhdpi)

What screen size should I design for Android?

320 × 480 is considered a “normal” screen size by Android.

How can I make Android apps compatible with all screen sizes?

Use Relative layouts, draw 9 images. And for high quality apps you may create different different layout XMLS for all 4 screen sizes.


1 Answers

Those two devices don't have the same density. The Samsung Infuse is hdpi, the Galaxy Tab 10.1 is mdpi.

Further, you don't generally want the image to be bigger on the tablet. Consider -- if I have a list of contacts in my application, I want them to be the same height on the phone vs. the tablet because there is no use making them taller (that height is sufficient to display the text and be able to tap on it with my finger), but rather that I want to do is use the extra space to be able to display more of them.

If you really do want an image that is larger on the tablet than on the phone, you are going to need to explain more about what you are actually trying to accomplish. For example, maybe this is a background image? In that case maybe what you are looking for is to just have the image stretch to fill the screen. (And be aware that doing background images on Android is tricky because you do need to deal with a wide variety of screen sizes you will be fitting. To avoid making yourself go insane, background images should generally be very abstract so that stretching works well on them. Look at the background images used in Android 3.0 and 4.0 for the default themes as an example.)

If you are writing a game, this is a very different world, and you should consider whether you want to use density based resources at all. Generally games will have resources that are independent of density, and just have their game playfield fill the screen and are happy with the result being something larger on a tablet.

like image 193
hackbod Avatar answered Sep 16 '22 17:09

hackbod