I want to design layouts which will support multiple screen and resulution,the normal hdpi layout is okay but the other layout like large mdpi is not displaying as expected.Here are the samples
Normal Hdpi
Large Mdpi
There are two ways for it:-
1)use DisplayMetrics
2) Making different layout files
if you going for using 2nd way then refer this link
read this:
http://developer.android.com/guide/practices/screens_support.html
put your drawables accordingly in ldpi, hdpi, mdpi, xhdpi folders.
read this as well for design guidelines:
http://developer.android.com/design/index.html
From your comment it seems like you want a background image for different densities.
You can achieve that from eclipse like this
Press ctrl+N(File-->New-->Others) ---> android---> android icon set-->Choose your preferecnce, provide the name & press next--->under foreground tab, press image---> provide url of an image----> press finish.
This will automatically create an image of different densities in your different folders.
Or if you dont want to use eclipse then,
http://romannurik.github.io/AndroidAssetStudio/
this link will serve the same purpose.
Related
I am new to android and having requirement to design my home screen for the app.which look like as shown below.
Home screen image.
as the picture shown above contain five button which having five different drawable image with different design and different size.the same layout while running in one device look different compare to the one running on other device.different device means here the different screen size and different resolution.so now the question is how to design that size and resolution of image and layout so its fit with any screen size and resolution on any device android device available in market and never expand or collapse with different screen size.i am testing the app in three different screen size device and resolution also and the look change for every device.Any kind of reply will be very helpful.
Use RelativeLayouts to separate the different boxes.
Apart from that, whatever you asked is broad.You should refer the Designing for Multiple Screens documentation available at android.
You should follow the advice that's detailed in the documentation on how to design for different screen sizes. You're going to have to have more than one image to handle all your scenarios obviously.
http://developer.android.com/guide/practices/screens_support.html
place Button background images in 4 resolutions in the res folder as ldpe mdpi hdpi and xhpdi .use Dip insted of dp.
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.
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.
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.
How to design a layout that should support all screen size.
See the Images below..
How can i make all screen looks properly with same images?
Edit:here larger screen [WXGA] displays in proper way. becoz i used image button there to change alphabets(Eg A,B,....)
Yes I am totally agree with Farray's answer. You should create separate layout files and put inside the particular folder like layout-land, layout-large-land, layout-large, etc. and create different drawables for the different densities and put those drawables inside the suitable folder like drawable, drawable-hdpi, drawable-ldpi, drawable-mdpi, etc.
For example:
Update:
As you want to put buttons for all the alphabets, in that case you should use GridView and define your custom adapter with ImageButton and set the same adapter inside the GridView, I am sure this will looks perfect as per your requirement. For your reference, I would like to suggest you to go through this: http://www.firstdroid.com/2011/02/06/android-tutorial-gridview-with-icon-and-text/
Unfortunately it's not as simple as scaling the images larger. That will produce very poor results on larger screen formats.
The proper way to support multiple screens is to include different resources for different size categories. At the very least you should create separate layout files for small and large screens and include different drawables for the screen densities you want to support.
There's a lot of information at http://developer.android.com/guide/practices/screens_support.html Maybe give that a read and then post additional questions if you have them?