Having bigger images for a xlarge screen in android - android

I am building an android application on version 2.2, I need to support for extra large screen. Layout rendering is no problem, but there are some devices which are extra large but are mdpi.
It is taking all the drawables from drawable-mdpi, I want my layout to take bigger images for xlarge screen, I have even defined drawable-xlarge for loading bigger images but still the images are getting loaded from drawable-mdpi folders.
My other drawable folders are
drawable-ldpi which has images of dimension of 32 by 32.
drawable-mdpi which has images of dimension of 48 by 48.
drawable-hdpi which has images of dimension of 72 by 72.
drawable-xhdpi which has images of dimension of 96 by 96.
then for extra large screens I have drawable-xlarge which has images of 108 by 108.
How to make android load bigger images for xlarge screens. App is not getting loaded with images from drawable-xlarge, are there any changes I should carry out to get bigger images loaded into xlarge screens rather than from drawable-mdpi folder.
Any help or pointers would be helpful.
thanks.

You will probably have to provide several other more specific qualified resource folders, such as drawable-xlarge-mdpi. Going by the information in Providing Resources, it should work the way you have it (i.e. screen size qualifiers should take precedence to density qualifiers) but it seems that for you it isn't working as expected. Are you certain it's an xlarge display? If so, I would try placing your images into res/drawable-xlarge-mdpi.

look it will be better if you make separate layout for x-large screens refer supporting multiple screens from android developers site
as the android system will fetch images from mdpi,hdpi,ldpi or xhdpi according to the screen density not according to the size

Related

Resolution in Android app

When I create my Android app i create 6 drawable folders:
drawable-hdpi. // resolution 1.5 x
drawable-mdpi. // resolution 1 x
drawable-xhdpi. // resolution 2 x.
drawable-large. // resolution 2 x.
drawable-xlarge. // resolution 2.5 x.
drawable-xxhdpi. // resolution 3 x.
In every folder i put the same image with different size according to android device resolution and screen size.
Is this correct? or this is insufficient for my android app ?
When i make project in Android Studio it automatically generates the folder structure for drawable- i.e
-- res
| -- drawable-hdpi (for low density screens)
-- drawable-mdpi (for medium density screens)
-- drawable-xhdpi (for high resolution screens)
-- drawable-xxhdpi (for extra high resolution screens)
The drawable-xxxhdpi qualifier is necessary only to provide a launcher icon that can appear larger than usual on an xxhdpi device. You do not need to provide xxxhdpi assets for all your app's images.
I think that the above is more than sufficient for an android application. And actually xxhdpi is more than enough for a high res tab or phone. Please go through Supporting Multiple Screens.
First, it's not necessary to put all the same images with different size in every folder. If you put the full set of images in drawable-xxhdpi folder, the system will re-size the image for other density automatically. Sometimes, some image may lost important details while re-sizing, then you should redesign a proper image for the density and put in the corresponding folder, not ALL images.
Second, xlarge/large/normal/small are the size of screen, ldpi/mdpi/hdpi/xhdpi/xxhdpi are the density of screen, the resolution is the combinations of size and density.
Finally, you may prepare just one set of image in res/drawable-xxhdpi folder, then design different layout for different screen size in res/layout-*** folders, just set different dp in width/height/margin etc..
Reference: https://developer.android.com/guide/practices/screens_support.html

Android different screen size and different densities [duplicate]

This question already has answers here:
Android screen size HDPI, LDPI, MDPI [duplicate]
(4 answers)
Closed 9 years ago.
I have to manage different screen sizes and different densities in my Android app.
I am not getting directory structure properly.
What I understand so far is there are four types of screen sizes:
small
normal
large
xlarge
and different densities as well:
ldpi
mdpi
hdpi
xhdpi
Now each device size (small , normal , large and xlarge) shall map against each density. Because every size can have different density, right?
If yes, then we can say small screen have all the density i.e ( ldpi , mdpi , hdpi , xhdpi)
same for normal, large and xlarge.
The point is how I'll manage them in my drawable directories.
Will there be four folders for small screen size with different size (drawable-small-ldpi, drawable-small-mdpi, drawable-small-hdpi, drawable-small-xhdpi)?
And same for other screen sizes as well.
If not then how I'll manage all the image in ( drawable-ldpi , drawable-mdpi , drawable-hdpi , drawable-xhdpi) folder because different screen size I'll have different size of images. Then how can a small device with different density and large device with a different size be manageable in same density folder.
Please don't give me reference of any Android document as I read all that stuff.
If any one can't get my point, then please let me know. I'm very confused.
When I have started development in Android, I was confused about same issue.But now I have figured it out and I'm doing pretty well.
Anyways, You are absolutely right.you can provide different images by 4 folders for each.i.e.: drawable-small-ldpi, drawable-small-mdpi, drawable-small-hdpi, drawable-small-xhdpi
But it is just waste of your time.because you don't need to worry this much about it.Android can scale up/scale down according to the device configuration.so just provide extra images for those devices only if you don't get desired outputs for them.
As far as I know, supporting multiple devices, you have to consider few general criteria in your mind.
Density qualifiers: ldpi,mdpi,hdpi,xhdpi,etc are generally used when you want to provide different resolution images.
Size qualifiers + Orientation qualifiers: small,normal,large,xlarge,sw600dp,normal-land,normal-port,etc are generally used when you want to provide different layout designs.
i.e.: single pane layout,multi-pane layout,different elements in layouts according to different screen sizes.
For reference: Download the example app from here and try to understand how it is being supported for multiple screens.
I hope it will be helpful !!
Here are official docs for you to read about the subject: Supporting Multiple Screens then Supporting Different Screen Sizes
Put your all image in all different folder that is drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi. android will take care of it.
What I always do is just put all my images in one folder (usually xhdpi). The Android system will scale them for you so you don't have to worry about what to put in what folder.
Heres what Android says about this:
Provide different bitmap drawables for different screen densities
By
default, Android scales your bitmap drawables (.png, .jpg, and .gif
files) and Nine-Patch drawables (.9.png files) so that they render at
the appropriate physical size on each device. For example, if your
application provides bitmap drawables only for the baseline, medium
screen density (mdpi), then the system scales them up when on a
high-density screen, and scales them down when on a low-density
screen. This scaling can cause artifacts in the bitmaps. To ensure
your bitmaps look their best, you should include alternative versions
at different resolutions for different screen densities. The
configuration qualifiers you can use for density-specific resources
are ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high).
For example, bitmaps for high-density screens should go in
drawable-hdpi/.
You can find the documentation here:
https://developer.android.com/guide/practices/screens_support.html
Hope this helps

Drawable folder different screen resolution issues

I am having the following specification images,
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Both in portrait and landscape. These are stretched in Tablet. But working fine in mobile. I am handling the configuration changes using the onConfigurationChanged() override method. Is any other way for giving the images for Android application. I reffered the following link for screen sizes. http://developer.android.com/guide/practices/screens_support.html
you can use drawable-large for tab
Following crocboy link is correct, and i suggest you to try including more buckets on your app. For example, in my applications i use also this:
drawable-sw600dp-mdpi
drawable-sw720dp-mdpi
In this buckets, put images that match tablets screen, for example in drawable-sw600dp-mdpi insert a background with this size 1280x800 and for drawable-sw720dp-mdpi a background with this size 1920x1200.
It's quite difficult to decide wich tablet to target, because we have different screen size.
EDIT
"application have to support all devices. So, the drawable folder images also have to support for all the devices. How to achieve this?".
Basically Android create this 4 folder for drawable:
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
(To be picky, low drawable-ldpi is not quite used, because small device are loosing appeal)But due to density and screen size you can have:
drawable-large-mdpi
drawable-large-hdpi
drawable-large-xhpdi
drawable-xlarge-hdpi
drawable-xlarge-mdpi
And so on with various combination! If you are looking for image perfection (like my graphics collegue, wich is an iOS psychopath) you have to create images for every type of screen, and put it on relative drawable bucket.
In the same link ("How to Support Multiple Screens"), they tell you how to create seperate drawable folders for each resolution - such as drawable-hdpi. When the system detects a high-resolution screen, it takes drawables from the high-density folders. You can also do the same with layout folders. If it's a low-resolution screen, it uses only images from the low-resolution images folder, drawable-ldpi. Here is also a good article article about how Android picks images from these folders.

Background images for different screens

In my application I have a background for activity. This is an image, I am going to use fitXY for it. I am ok if it will be resized a little (keeping aspect ration is not very important) but not very much.
I am going to prepare few images with different size and for both Portrait and Landscape orientation. I am going to cover about 90% of devices.
My question is the following:
What images sizes I need for background?
What folders under "res" I should put these images?
I would like to get very specific file sizes and folder name where to put these files.
The solution should work on tablets as well.
I just used two images with maximum sizes (one portrait and one landscape). Then android resized the to smaller and it looks quite good for me.
I have one background with resolution: 800*1200 px in drawable folder
and another with resolution: 1200*800 px in drawable-land folder
This works pretty fine on tablets.
You have to create multiple resources for your app. Android has 4 resolutions (ldpi,mdpi,hdpi and xhdpi) and 4 generalized screen sizes (small, medium, large and extra large). So you have to make 4 layouts (or 3 if you don't plan on supporting tablets, since tablets come under the extra large category) to support the screen sizes.
Here's a general guide:
put layouts for small, medium, large and extra large in your res/ folder as follows:
res/layout/sample_layout.xml // default layout
res/layout-small/sample_layout.xml // layout for small screen size
res/layout-large/sample_layout.xml // layout for large screen size
res/layout-xlarge/sample_layout.xml // layout for extra large screen size
you can also use
res/layout-land/sample_layout.xml for landscape orientation for all screen sizes or you can target landscape layouts for specific screen sizes as res/layout-medium-land/sample_layout.xml
note that all the layouts have the same name.
once you have your layouts ready, you need to take care of image resolutions also
once again in your res/ folder add images like this:
res/drawable-ldpi/sample_image.png // low density
res/drawable-mdpi/sample_image.png // medium density
res/drawable-hdpi/sample_image.png // high density
res/drawable-xhdpi/sample_image.png // extra high density
once again, all the images have the same name.
general guidelines for designing images are:
ldpi is 0.75x dimensions of mdpi
hdpi is 1.5x dimensions of mdpi
xhdpi is 2x dimensinons of mdpi
generally, I design mdpi images for a 320x480 screen and then multiply the dimensions as per the above rules to get images for other resolutions.
Android will automatically select the best combination of layout and image depending on the device. For example, for a high resolution medium size device, layout-medium and high density image will be displayed to the user.
Make sure you create emulators for all these combinations and test your app thoroughly. here's the official docs for more info:
https://developer.android.com/guide/practices/screens_support.html
m/h/xh dpi are the most important. Combine that with the (most common) resolutions and you should be fine for your "90%" target.

Android, concerning the User Interface design

the more I read the Supporting Multiple Screens guide, the more I get confused.
if the layout folder's qualifier is based on size (small, normal, large and xlarge) and the drawable folder's qualifier is based on density (ldpi, mdpi,hdpi and xhdpi),
then how can I specify the size of the drawables/images??
should all the images inside the drawable folders have the same size (based on the normal screen size) but different densities (i.e. pic.png inside drawable.ldpi has the same width and height of pic.png inside drawable.mdpi but has different density)??
the problem is that each screen size may include the three densities (i.e. a large screen may be ldpi,mdpi or hdpi).
.how can I be designing the images on size basis and on density basis on the same time??
thank you.
36x36 for low-density
48x48 for medium-density
72x72 for high-density
96x96 for extra high-density
http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
hope this helps.
In general you'll want the smallest pictures in ldpi, middle ones in mdpi, and larger in hdpi etc...
Even though it is technically possible for a device to have a "large" screen and an "ldpi" density manufactures have tended to stick to making devices with big screens be higher density as well.
EDIT:
The images only need to be designed with density in mind. Because if you take the same 100x100 pixel image and show it at 3 different densities it will appear largest (to human eyes) on the smallest density. So to account for that you make 3 images, lets say one 80x80, one 100x100, and one 120x120. Now if you show those 3 images across 3 densities the size that object appears to be to your eyes will be much closer than before.
the large, medium, small etc... qualifiers that you can add to the layout folders are not so much about any image resources themselves, but rather structuring the View components on the given page so as to make best use of the space available.
For instance, if your application has a list of items to choose from in it. On a tablet (large or xlarge) screen it may look nicer and be more effecient to have two or more columns of items displayed in your list on the screen. Whereas on a handset there may not be enough width (in portrait mode) to fit more than 1 column in. So to handle this situation you'd put a layout xml file inside the layout-normal folder that has a single column ListView. Then put another layout xml file in the layout-large folder that uses a GridView so that it can have an additional column
This image will show you roughly which folder the system will pull your images and/ or layout xml files from given the screen size and density.:
All of your image resources go in the drawable folders which are qualified with the densities. (ldpi, mdpi, hdpi etc)
The layout folders are what get qualified with the screen size (small, normal, large etc) The layout folders will contain xml layout files only, no images.

Categories

Resources