I need every picture that I have in my program to be created for different densities (mdpi, ldpi, hdpi)? If yes, which density has to be for hdpi? Which one for ldpi?
And the second question. What I don`t understand, that what about screen sizes? What people usually do for support of tablets? They do not do anything with images, they just creating different layouts (which is more convenient)? Am I right or I do not understand?
It would be good to read something besides official documentation. Something that was written in language which is more human.
Thank you.
You can use 9-patch for some of you img. for example - backgrounds.
but actually - yes, you need images in 4-size
Proportion are:
mdpi= *4;
ldpi= *3;
hdpi= *6;
xhdpi= *8.
So if you have image mdpi 24*24 px, you must make it 36*36 px for hdpi
And some good resourse http://www.androidguys.com/2010/02/18/handling-multiple-screen-sizes-part-2/
commonly using just hdip images.(or xhdip)
but if u need correct size, make images for other densities
for tablets, need high resolution images.
Related
If I put my application resources in drawable-xdpi then it is automatically down converted for hdpi, mdpi and ldpi by ration 0.75, 0.05 and so on.
Why we need to create extra resource if one type is enough only?
I believe it is enough if I create for xhdpi and let Android down scales automatically. I have gone through this question
What is the best way to create drawables for different dpi
but no one has given answer that yes you can go this way.
Suppose I kept my images in xhdpi and when app opens in hdpi it will reduce size to 0.75, when it opens in mdpi it reduces size to 0.5.
So what is best way to create draw able asset? Please suggest perfect way with valid reason.
If not needed why we are creating so many resources instead for one only like xdpi?
There are two reasons to provide more than one image:
it is more efficient to load an image that is already the correct size.
The automatic downscaling may produce artifacts, which can be disturbing especially for small images. So if you want a pixel perfect image it is better to provide one in the correct size.
If none of them is a problem for you, it is also fine to go just with one image.
If u want to display same image with different resolutions in devices
xhdpi image then place it drawable-xhdpi
hdpi image then place it in drawable-hdpi**
or to maintain a drawable folder place all the images what you want to display it will display with same size in all devices irrespective of the resolution.
I have a quick question: will it work when I put the same 57px x 57px icon to all drawable-ldpi, drawable-mdpi and drawable-hdpi folders. Will it run on all devices?
in other words if small icon will be visible on big screens or x-large screens.
It will work, but you really should not use size of 57x57 for any screen size - scaled down images will look as ugly as scaled up. Better avoid it.
Please read more here: http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html (yes, it is an official documentation).
Yes, it'll work. But it is good to have all icons. Because it'll be pixelat on large screens.
If you simple put icon in drawalbe folder (which is default folder) and you don't have any other folders like hdpi, mdpi, ldpi for all screen sizes. then it'll also be considered for all resolutions/sizes.
It will work. But it will not look well on some screen.
My question is straight forward and simple, Like there is layout-sw600dp,values-sw600dp, for layout and values respectively, what is there for drawable folder in relative to size of screen.
I read in various document that if we want to use any screen more than or equal to 7 inches we can use layout-sw600dp folder, and for any lesser screen size device, layout folder will be taken into consideration. So how we can make use of same concept for images also. Right now there are ldpi, mdpi, hdpi folder, but images are taken in accordance of screen density not with screen size.Now if I am developing an app which work both on device and phone, what should be my probable approach for images.
Thanks in advance, please guide me.
you can also use the same concept for drawable like drawable-sw600dp,drawable-sw600dp-mdpi etc. I have used this in my application .
I'm not 100% on this one, but I think you can also use the same convention with drawables. Try drawable-sw600dp-hdpi or something similar. Though I also do have a few questions you may want to answer before proceeding:
Why would you want a different image (not resolution) for a bigger screen size?
As you already know, a 7-inch device would be using the layout-sw600dp folder, so why not have a different name for a different drawable? That would look a lot cleaner, imo.
I have a game which displays a full screen image in the background. At the moment I have one image size (1280x800). This works well on large resolutions but on smaller screens the shrinking somewhat degrades the image. You can see jagged edges and it is noticeably worse than what you could achieve using photoshop software.
I have different image sizes, but I am unsure how to utilize them. I know there are different dpi folders, but you can have resolutions of 480x320 and 1280x768 with the same dpi so I don't think these can be of use here.
I believe you can have different layout files for different screen sizes, but the image is not drawn using xml (and in fact would not be possible for my game).
I can only think that I must create a different file name for each size. Then when choosing which image to use I could take the screen dimensions and select the correct one? I am struggling to see how I can make an image look good on both 240x320 and 1280x800 resolutions.
All of the resource qualifiers in the framework can be applied to drawables, not just the dpi designators. In other words, you could create folders like this to segment your images as well:
drawable-ldpi
drawable-xlarge
drawable-normal
drawable-sw480dp
drawable-sw720dp
Even examples like these work...
drawable-v10
drawable-land
And so on...
You can create as many or as few different qualified directories for your image assets as you think necessary to preserve the quality. The Supporting Multiple Screens article in the SDK docs helps describe most of the qualifiers that best fit scaling image assets.
HTH!
I am new to android programming. I have a background in my layout file and some image buttons on top. When the orientation of the phone is changed, I dont want the background to change orientation, but I want the image buttons to rotate appropriately. What is the best way to get this functionality?
Also I want to know the resolution of the images for the background for hdpi, mdpi and ldpi. Does it matter if I keep the same pixel size for each of them?
You can read about rotation here: http://developer.android.com/resources/articles/faster-screen-orientation-change.html
There is variety of different resolution for hdpi, mdpi and ldpi. http://developer.android.com/resources/dashboard/screens.html - here you can see what sizes and densities are the most popular. However, you can create layout specially for resolution you need (i.e. several layout for hdpi devices with different resolutions). The most popular resolutions are 320x480, 800x480, 854x480 (often I use the same layout as for 800x480).
You can read about supporting multiple screens here: http://developer.android.com/guide/practices/screens_support.html
No it doesn't matter I think, but can be there some resolution changes, like pixeled parts. I think that the best way to do it, if you make a land suffixed map for your layouts and drawables like: layout-land
Hope it helps!