Supporting Multiple Screens (2560X1600 and 1280x720) - android

I have requirement to support all screen sizes on Android (Phones and Tablets). I have a set of images with resolutions 1280x720 and 2560x1600.
Question
How to name drawable and layout folders, so that these images are scaled correctly for all resolutions(if possible) ?
I'm clear that the question has been asked very often, but all I can find are half answers. I tried to create drawable folders with names:
drawable-xlarge-mdpi - for 1200X800
drawable-xlarge-xhdpi - for 2560X1600
And for layout, with names:
layout-xlarge-mdpi - for 1280x720
layout-xlarge-xhdpi - for 25601600
And added a manifest entry:
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
But now, it works only for tablets. On phones it always fails with error.
I found an answer here:
Drawables for qHD resolution
As I understand, all scaling occurs through code. But can anyone explain to me how to scale the image in the code with a resolution of 1280x720 and 2560x1600 and in which folder are to be placed in ?
I have read:
Application Skeleton to support multiple screen
Android : App support for multiple tablet screen resolutions
http://developer.android.com/guide/practices/screens_support.html
Android: support multiple screens
and many more.

Related

Screen Resolution for different Android Devices [duplicate]

This question already has answers here:
Application Skeleton to support multiple screens
(2 answers)
Closed 9 years ago.
How to Solve Screen Resolution Problem?
I want my application run on any android device, and its layout should not change,
I read android Blog of Supporting Multiple Screens,But do not get enough idea.
I have created different layout folder like layout-small,layout-normal,layout-large,layout-xlarge and created different XML files for all folder.
But when i run on Tablet it takes Default normal size XML file,I don't know why?
Please help me to solve it, Thanks in advance and Waiting for response
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Add this to your manifest file of app.
Create the layout and drawable with following qualifiers
layout-sw600dp drawable-sw600dp
which means tablet screen with minimum of 600dp and higher can use this layout and drawable.
So for standard configuration qualifiers for screen size you can create following configuration:
1)layout-sw480dp drawable-sw480dp
2)layout-sw600dp drawable-sw600dp
3)layout-sw720dp drawable-sw720dp
check http://android-developers.blogspot.in/2011_07_01_archive.html
Following the guide will only help you to deal the problem for the most cases, but never all the scenarios. Check the following list which is the Google's AOSP homescreen source code. Even this cannot guarantee it will work for all the devices. So yours are far from enough.
drawable
drawable-hdpi
drawable-land-hdpi
drawable-land-mdpi
drawable-land-xhdpi
drawable-mdpi
drawable-nodpi
drawable-sw600dp-hdpi
drawable-sw600dp-land-hdpi
drawable-sw600dp-land-mdpi
drawable-sw600dp-mdpi
drawable-sw600dp-nodpi
drawable-sw600dp-xhdpi
drawable-sw720dp-hdpi
drawable-sw720dp-land-hdpi
drawable-sw720dp-land-mdpi
drawable-sw720dp-mdpi
drawable-sw720dp-nodpi
drawable-sw720dp-xhdpi
drawable-xhdpi
layout
layout-land
layout-port
layout-sw600dp-port
layout-sw720dp
layout-sw720dp-port
According to this page the layout-small,layout-normal,layout-large,layout-xlarge
are deprecated and you will use the
36x36 for low-density
48x48 for medium-density
72x72 for high-density
96x96 for extra high-density
as alernative, however for further information please check my answer here

Support-Screens in Manifest File [duplicate]

So I used the following code below to have my application to scale screen size on different android devices but when I am testing on my Nexus 7 its does not scale and its as if it was on a 4 inch screen. When I run it in the emulator on a 7 inch screen it works. Anything wrong with my manifest file?
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:normalScreens="true"
android:anyDensity="true"
/>
this code goes right before the "application" part right?
Ok, so what you have to know is that support-screens doesn't make your application look 'nice' on screens you are supporting (check this link). It just tells that users with such screens will be able to download your application, but it's up to you to make it display properly. You have to create layouts for specific screens on your own.
More about it you can read in Android's documentation: http://developer.android.com/guide/practices/screens_support.html
Basically, you have to properly name your directories in which layout files are stored in order to let Android know which one should it pick up for specific device. If for example your layout's file was "layout.xml" you should have:
/res/layout/layout.xml // Default layout
/res/layout-small/layout.xml // Small screens
/res/layout-large/layout.xml // Large screens
/res/layout-xlarge/layout.xml // Extra large screens
You can go even further and make also different layouts for portrait and landscape views by specyfing another keyword in directory's name:
/res/layout-small-land/layout.xml // Small screens, landscape view
/res/layout-small-portrait/layout.xml // Small screens, portrait view
Remember that tags order is important, so you can't write layout-portrait-small.
Use Relative layout it will solve most of your problem .Additional use Folder name with given below
the way i am dealing with multiple screen is this way and its working fine.....if any one has improved wayso do guide me
Screen size 480x800
layout-normal-hdpi-480x800
drawable-normal-hdpi-480x800
Screen size Galaxy Nexus--- though its size is 1280x720 but in actual due to system bar its dimension(screen size) differs
layout-normal-xhdpi
drawable-normal-xhdpi
Screen size Note 5.3---
layout-normal-xhdpi-1280x800
drawable-normal-xhdpi-1280x800
Screen size S3---
layout-normal-xhdpi-1280x720
drawable-normal-xhdpi-1280x720
Screen size 7inch tab 2 supporting OS version 3 and above--- dont write dimension 1026x600 bsz in actual due to system bar its dimension(screen size) differs
layout-large-mdpi
drawable-large-mdpi
Screen size 7inch tab p1000 etc supoorting os verion less than 3---
layout-large-hdpi-1024x600
drawable-large-hdpi-1024x600
Screen size 1280x800 tab 10.1,10.2,note 10.1 etc--- you can add dimension if you want other wise it is fine
layout-xlarge-mdpi
drawable-xlarge-mdpi

Multiple Screens Android

I'm developing an app in android and I have to support many different screen sizes and density. So i've created different a folder for layout : layout and layout-large.
For a normal screen size I have these drawable folders: mdpi(with a 320x480 image in it), hdpi (with a 480x800 image in it), and xhdpi (with a 640x960 image in it), but I also need a mdpi for a xlarge size screen. Should I create a drawable-large-mdpi and then put my image (480x800) in there?
Anyways I tried to do that and it seems to work just fine.
On my manifest I have:
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
I'm using three different emulators:
4.0" WVGA (480X800: hdpi),
3.2" HVGA slider (ADP1) (320x480:mdpi), and
5.1" WVGA (480X800: mdpi)
My problem is that when I run it the size of the screen never match in any of the emulators. The width seems to get a bit smaller. It is never 100%
In the AVD manager when you start your AVD manually you get Launch options, there put a check mark against scale display to real size.
Setup your monitors dpi by clicking on the question mark.
Enter the monitor screen size and monitors resolution and then click on ok.
Now enter the screen size for your emulator in inches and then click on launch.
Do the same for all three emulators your testing the app against.

How to have android application support multiple screen sizes with <supports-screens

So I used the following code below to have my application to scale screen size on different android devices but when I am testing on my Nexus 7 its does not scale and its as if it was on a 4 inch screen. When I run it in the emulator on a 7 inch screen it works. Anything wrong with my manifest file?
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:normalScreens="true"
android:anyDensity="true"
/>
this code goes right before the "application" part right?
Ok, so what you have to know is that support-screens doesn't make your application look 'nice' on screens you are supporting (check this link). It just tells that users with such screens will be able to download your application, but it's up to you to make it display properly. You have to create layouts for specific screens on your own.
More about it you can read in Android's documentation: http://developer.android.com/guide/practices/screens_support.html
Basically, you have to properly name your directories in which layout files are stored in order to let Android know which one should it pick up for specific device. If for example your layout's file was "layout.xml" you should have:
/res/layout/layout.xml // Default layout
/res/layout-small/layout.xml // Small screens
/res/layout-large/layout.xml // Large screens
/res/layout-xlarge/layout.xml // Extra large screens
You can go even further and make also different layouts for portrait and landscape views by specyfing another keyword in directory's name:
/res/layout-small-land/layout.xml // Small screens, landscape view
/res/layout-small-portrait/layout.xml // Small screens, portrait view
Remember that tags order is important, so you can't write layout-portrait-small.
Use Relative layout it will solve most of your problem .Additional use Folder name with given below
the way i am dealing with multiple screen is this way and its working fine.....if any one has improved wayso do guide me
Screen size 480x800
layout-normal-hdpi-480x800
drawable-normal-hdpi-480x800
Screen size Galaxy Nexus--- though its size is 1280x720 but in actual due to system bar its dimension(screen size) differs
layout-normal-xhdpi
drawable-normal-xhdpi
Screen size Note 5.3---
layout-normal-xhdpi-1280x800
drawable-normal-xhdpi-1280x800
Screen size S3---
layout-normal-xhdpi-1280x720
drawable-normal-xhdpi-1280x720
Screen size 7inch tab 2 supporting OS version 3 and above--- dont write dimension 1026x600 bsz in actual due to system bar its dimension(screen size) differs
layout-large-mdpi
drawable-large-mdpi
Screen size 7inch tab p1000 etc supoorting os verion less than 3---
layout-large-hdpi-1024x600
drawable-large-hdpi-1024x600
Screen size 1280x800 tab 10.1,10.2,note 10.1 etc--- you can add dimension if you want other wise it is fine
layout-xlarge-mdpi
drawable-xlarge-mdpi

How to place images in Android drawables

Android Asus tablet is acessing images from android mdpi drawable and also lgoptimusp509 is accessing images from same mdpi folder.
Due to this I am facing alignment problems. How to fix this?
You should provide resources for multiple resolution and densities by following the guidelines at Supporting Multiple Screens.
There is also a tool from Google Android Asset Studio where you can upload your icons,menu icons,action bar icons and it will properly scale them for ldpi,mdpi,hdpi. You should also have a look at that.
You should provide resources for multiple resolution and densities.
so you have to put same images in hdpi,mdpi and ldpi drawable folder with diff resolutions.
and write this code in android manifest.xml
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
Devices access the images according to their density.so you should put same images in hdpi,mdpi and ldpi drawable folder with different resolution,so that those images will fit in respective devices.

Categories

Resources