I have to design an application which to support under three resolution. for that i use the code in manifest
and also create three folder layout , layout-large, layout-small for supporting three resolution, correspondingly i put the different resolution of image in drawable-hdpi ,drawable-ldpi ,drawable-mdpi , but whenever i run the app in different resolution it going to take low resolution image instead of different resolution i use.
I don`t know where i made the mistake, whether i have to add some code in layout xml or not. I also search the android developer forum and i do the application design as they insist.
Any one suggest some idea to achieve this.Thanks
There are two things you could check: have you set the minimum SDK version of your app to use version 4 (Android 1.6) support for this started?
Secondly, the layout-large and layout-small folders are designed for different sized screens (think tablet vs phone), and not resolution. If you're changing the resolution (DPI) of the device, you'll need to use layout-hdpi, layout-ldpi etc.
Further, if it's only the images you're changing, you should be placing the different images in drawable-hdpi, drawable-ldpi etc, and not layout-xxxx. If on a supported device, Android will pick the image from the correct folder, so you'll only have one layout folder (or 2 if you use layout-land)
Some (or all :S) of these points are covered in this link, to another question on StackOverflow. Try to use the search function before asking a question. Also, you'll find people are more receptive to providing answers to users with higher accept percentages.
Android - layout-large folder is been ignored
Edit: for multiple screen support, also look at Fragments to better organise and fit your content for both large and small screen devices (dev.Android, worked example)
Related
Since the launch of Nexus 5X and Nexus 6P, I have noticed my layout designed previously looks relatively small on these new two devices. I tried creating multiple Layout resource folders but nothing seems to be working efficiently. After going through multiple tutorials and blogs, I am still struggling with this issue. Any kind of help or tutorial would be really appreciated.
Using multiple layouts is the correct way to solve Layout problem only. Besides, you also need adding suitable drawable resolutions and dimensions.
See more:
Make sure to use dp and sp as your scale.
Make sure if the correct layout folder is being picked by the mobile phone (see note below)
Resolution of image assets must be proportional to the dpi - check the Android icon resolution requirements and scale your image assets accordingly.
*To determine if the app does pick the layout folder you intend the app to pick - you could change the background for different layout folders and determine which one it picks *
I'm having both layout folders "layout-v10" and "layout-hdpi" in my application. However, as some gingerbread(which is API Level 10) devices also are hdpi screen size, the layouts under the "layout-hdpi" folder is getting inflated. I want to force the layout from "layout-v10" folder to be inflated for all gingerbread devices even if it is a hdpi. Is there any way to do so?
I read this link http://developer.android.com/guide/practices/screens_support.html couldn't figure out what can be done to solve my problem.
to keep layouts looking good in all devices we don't provide folders like "layout-hdpi", etc.
U need to keep your resources in drawable-hdpi, drawable-xhdpi, etc. as mentioned in the android developers guide. The android system chooses the correct folder based on the screen density. This works independent of the api version you are using, the layout will look good in all api levels if you are defining your resources correctly acc. to different screen densities.
I created a special layout for one of my activities in the /layout-small folder. The problem is that when I open my default layout (the one for which I have the small version), Eclipse decides to open the small version instead! At this point I go back the 'normal' layout but it's displayed for a 2.7" screen and if I make any change to visualize it in any other screen size Eclipse decides to send me to my 'small' layout while keeping the default one at 2.7". I can change my small layout to any size I want but that really makes no sense at all!
Any help is appreciated. Project CLEAN and restarting Eclipse I already tried.
I also had your problem for managing different screen sizes. The one that I use most frequently is to reorganize my layout folders in the same order as drawables. By this I mean that I create these folders for layout :
layout-ldpi
layout-mdpi
layout-hdpi
layout-xhdpi
If you open a layout file from the "layout-hdpi" folder , the default device for displaying the preview will be an hdpi one , like "4.0 480*800 hdpi".
Also. I found it much more time-consuming when adapting to different screens.
Another workaround that I'm really in favor of, is using the Intellij Community Edition for android development and user interface design. Intellij is a very stable and robust IDE based on gradle and is much much smoother than the buggy Eclipse.
If you are still having layout issues then I suggest reading this:
http://developer.android.com/guide/practices/screens_support.html
As of API level 13 layout-small/normal/large have been deprecated and you should be using sw<>dp qualifiers.
I have an app that has multiple layouts and my standard layout file is for screens that have the smallest available width like so:
layout (smallest screens)
layout-sw480dp (screens that are slightly larger)
layout-sw600dp (7" tablets)
layout-sw720dp (10" tablets)
i´m pretty new to android development and creating different layouts for each resolution wasn´t really that easy for me.
So, I was able to optimize my app for most devices (in eclipse), but i´m still having some problems here and there:
do I really have to copy the same images with different resolutions for each device-resolution into the respective folder? I´m currently using the hdpi, large-hdpi, mdpi and xdpi folders...
isnt it possible to use one drawable-folder and just scale the images down?
is there an extra drawable-folder for those 5.1in (WVGA)/5.4in (FWVGA) devices? In eclipse they´re labeled with mdpi, but these devices are using the large-hdpi folder and those images are too big, but perfect for i.e. nexus 7.
i´m also using 4 different layout-folders (layout-sw360dp, sw480dp, sw600dp & sw720dp). Is that a proper way to create a layout for each device-group?
Hopefully someone is able to help me with this.
Thanks in advance!
1) Yes you have to copy the images with different resolutions for each device resolution into respective folder. Because if you don't do that you will have unexpected results on different screen sized i.e. misplaced controls and layout will not be proper.
2) If you scale the images then they will get stretched or squeezed and you will not get proper result on the screen.
3) Folders sometimes behave differently on different devices. Sometimes they don't use the folders they are intended to use.
4) Yeah! as recommended in the documentation it is a good practice to use different folder as you can't be sure of the screen sizes in android.
I have developed an android application and run it on an HVGA emulator. It's running successfully on any HVGA device i.e. mdpi. But if I try to run on small screen resolution devices i.e QVGA then my buttons are looking as if they go down and dont fit onto the small screen...
So how can I run my android application on multiple screen resolution successfully?
follow these instructions
create a folder in yourAppFolder/res/ named layout-small (*more on this subject later)
insert in this folder all your xml layout items that need special treatment for a small screen (it is not necessary to copy all of "normal" layout files, but you can if you wish)
change the files in this layout as needed
What happens with this approach:
if the device has a non-small screen, the default layout (the one in "layout" folder) will be loaded and used, otherwise if the screen is in "small" category the files in "layout-small" will be used instead (only if one with the same name is available, otherwise the one in "layout" will be used
*About folder naming: that policy was the old one supported by android. Nowadays there is another one, more precise but more complex too (example: specify minimum necessary width). Anyway, this is still supported, just note that eclipse may suggest you some alternatives. Currently, i am still developing with the old naming policy.
I think it is better to design your layout for every screen size and resolutions. It is easy in android. Copy your layout from "layout" folder of resources and paste it in the "layout-land", "layout-xlarge", "layout-xlarge-land" and ... folders and change those settings you need in them.
you can check this link:
In the UI builder (part of the Eclipse plugin), you can build your interfaces for multiple screen sizes and resolutions. To make different layouts for different resolutions, simply follow these instructions to build alternate layouts:
http://developer.android.com/guide/practices/screens_support.html#support