What size images should i put in drawable-mdpi folder - android

I have three device with resolution 320x480, 1024 x 600, 1280 x 800. out of these three devices two are tablets. Now each of these devices has a density 160dp, as a result of this, all of this device takes images from the drawable-mdpi folder. Now my question is what will be the size of the image should I put inside this drawable-mdpi folder? So that it looks good in all of these devices.

//for phone you need to put in
drawable-mdpi
//for tablet you need to put in
drawable large-mdpi
NOTE: this large-mdi drawble is enough for 10' inch device
for few images your can use drawable-xlarge-mdpi like background with 1280*800 or splash screen..
an you can create different layout to adjust the view or arranging the drawables as
layout-large and layout-xlarge

put 320x480 size images in drawable-mdpi folder.
See here

Related

Load different layout / dimensions depending on screen size and resolution in Android

I am trying to load a different xml file for the layout and dimens in Android. I have tried creating an xlarge folder (for 10 inch tablet) and large folder (for 7 inch tablet). So the folder are called values-xlarge and values-large or values-xlarge and values-large. The 10 inch tablet has a density of 224 ppi.
If I use these layout files, the layout file from the values-large folder is used for the 10 inch tablet. How can I load a different design for 7 and 10 inch tablets? And which appendix should be used to the folder? I have found small, medium, large, ..., sw700dp, sw600dp and mdpi, hdpi, etc.
I use sw720dp, sw350dp-land, sw350dp, etc.
The layout in the folder will be used for a screen with the smallest width (sw...) of 720dp, etc. ie. sw700dp will be used for screens with 700dp or more or up until the next sw???dp layout.
It is in Display Independent Pixels, not regular pixels. ie. pixel width divided by the screen dpi. You can also add a -land or -port to only use this layout if it is landscape or portrait.
Check out this link for more information.
https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes

On one android handset, it is taking image from different folders

In my android app I am using mdpi, hdpi and xdpi resource folder and I have placed different sets of images on the basis of resolution in these folders for example:
mdpi contain images of 320x 480 resolution
hdpi contain images of 480 x 800 resolution
xhdpi contain images of 720 x 1280 resolution
When I load the application in Samsung S3, for tabs in tabwidget, it takes images from xhdpi folder and for the buttons it take images from hdpi folder.
Just try this once..
place 320 X 480 images in drawable-mdpi,
place 480 X 800 images in drawable-hdpi,
place 720 X 1280 images in drawable-xlarge-v11.
Once check with name conflict of images also. Use same image names in all folders.
Put the images for buttons in x-hdpi folder. When android don't images in x-hdpi folder, it goes to find it in next lower resolution folder.
But the either case of this is not true. When android requires any image from hdpi folder, it doesn't take images from x-hdpi folder. Infact it will crash if the images are not present in lower resolution other than hdpi.

How to know which drawable resource to load in graphical layout?

In my XML Graphical Layout I set the screen to 3.2in HVGA slider (ADP1) 320x480 mdpi.
But it still uses my hdpi-drawable resource. I checked my mdpi folder and my scaled image is there 70x70. But it uses my 105x105 image in the hdpi folder. Oddly, when I use the xhdpi and hdpi screens it works fine, they use their own drawables.
And another questions why does 10.1in WXGA (Tablet) 1280x800 mdpi use mdpi resources considering it is a tablet and has high resolution?
Sorry for my english, any help will be appreciated.

Where to store images in Android drawables folder?

I am working on Android application that should support 2.1 till latest Android OS (4.2) version. Currently I have few images to display in my image-gallery module.
I need to support my app on all devices (smartphone and tablet) which support OS ranging from 2.1 to 4.2 (latest).
Each image is roughly of size 368X387, 50 KB each, PNG type
My workspace res contains following drawable folders:
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xdpi
I have some confusion around
In which folder should I store the images, and how will that matter?
Do I need to have different resolution based images for different type of devices?
Thanks.
You can store images only in 1 folder BUT,
for example you have device that is mdpi.. it will look good on him, but if you run your app on ldpi android will automatically scale your image and it will look ugly (low quality). So yea you need different resolution based images for different types of devices..
so mdpi resolution images go to drawable-mdpi
so hdpi resolution images go to drawable-hdpi etcc..
this is some list i found on internet about screen sizes, maybe you will find it helpful:
Low density Small screens QVGA 240x320 (120dpi):
layout-small-ldpi (240x320)
layout-small-land-ldpi (320x240)
Low density Normal screens WVGA400 240x400 (x432) (120dpi):
layout-ldpi (240 x 400 )
layout-land-ldpi (400 x 240 )
Medium density Normal screens HVGA 320x480 (160dpi):
layout-mdpi (320 x 480 )
layout-land-mdpi (480 x 320 )
Medium density Large screens HVGA 320x480 (160dpi):
layout-large-mdpi (320 x 480 )
layout-large-land-mdpi (480 x 320)
Galaxy Tab ( 240 dpi ):
layout-large (600 x 1024)
layout-large-land (1024 x 600)
High density Normal screens WVGA800 480x800 (x854) (240 dpi):
layout-hdpi (480 x 800)
layout-land-hdpi (800 x 480)
Xoom (medium density large but 1280x800 res) (160 dpi):
layout-xlarge (800 x 1280)
layout-xlarge-land (1280 x 800)
Also it would be good to read official documents site about supporting different types of screen.
There are four folder in resource folder 1- drawable-hdpi 2-drawable-ldpi 3-drawable-mdpi
4-drawable-xdpi
To declare different layouts and bitmaps you'd like to use for different screens, you must place these alternative resources in separate directories/folders. This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
Then, place the files in the appropriate drawable resource directory: as per your need
if you want to use same images for all types of screen then you can make an other folder named "drawable" and put all images in that folder. it would work as default drawable.
but if you want to improve image quality on all resolutions. then you need all 4 types images and put then on their respective folder with same image name. you can also make differ XMLs for each resolution.
See this http://developer.android.com/training/multiscreen/screendensities.html
You can put a particular image in all folders.
drawable-hdpi
---->img.png
drawable-ldpi
---->img.png
drawable-mdpi
---->img.png
drawable-xdpi
---->img.png
It all depends on your os .it ll take by default according to device resolution .
In android we have "Res" folder is nothing but resources folder.Inside this res folder we have other sub folders but for storing images we have four types of folders names are called:
drawable-hdpi
for High density screens and its resolutions is 480*800
drawable-ldpi
for Low density screens and its resolutions is 240*320
drawable-mdpi
for Medium density screens and its resolutions is 320*480
drawable-xdpi
for Xtra density density screens and its resolutions is 640*960
If you want to match image for multiple screens my suggestion is to use
Nine patch image rather than .png and .bmp
for creating nine patch image
http://developer.android.com/tools/help/draw9patch.html

android layout on different screen sizes

i have an application that am trying to implement it on a tablet 7'. this that i have done is the follow. on the folder drawable and layout are my defaults for the normal smartphone screen. also i have create the layout-xlarge and drawable-mdpi in which on the first one i have change the sizes and on the second one i add the images with different size. my problem is that the default get the size of images that i have on the drawable-mdpi folder and not from the default drawable folder. what am i doing wrong? also i have nothing declare on the manifest.
mdpi is the default, so drawable and drawable-mdpi are the same thing and I don't know which Android chooses in this case - but you're designing for a tablet and tablets are generally mdpi devices so it correctly gets it from drawable-mdpi. You could use drawable-xlarge-mdpi if you want separate mdpi resources to be used for extra-large screens. Incidentally, remember a 7" 1024x600 tablet is large, not xlarge - so try drawable-large-mdpi and layout-large-mdpi and see if that gives you what you want.

Categories

Resources