issue in layout related to multiple screen support - android

am developing an application which support from 2.3.3 to 4.2. here am developing an application which can support both phone and tablet. for that i created sperate layouts and saved in different folder.
i tested my application with a test device X-treme 7" Internet tablet which is android 4.0.1 version. but when i test with my tablet its not take layouts from layout-large folder. but when i test with emulator which runs android 3.0 OS it takes layouts from large folder.
and my doubt is that why my application is not working properly (ie, took layout properly) ??

The X-treme 7" Internet tablet has a resolution of 800x480. With a 7" screen, that puts the pixels per inch somewhere around 80, which falls into very low end of the ldpi scale (which is <=120ppi. To convert a resolution of 800x480 to a density independent pixel (dp) screen size, we must multiply by ldpi's scaling of 0.75, which gives us a resolution of 600dp x 360 dp.
As per the range of screen supported guide, a large screen must be at least 640dp x 480dp, therefore your X-treme 7" Internet tablet should be classified as a normal screen device, hence why it is not picking up your layout-large layouts.
You can use any number of the many apps on Google Play to confirm your tablet's screen density and what resources it should be loading.

Related

Android layouts - Would it be reasonable to create more Layout Folders than sw320, sw480 sw600 sw720 sizes?

In order to support different screen sizes in an Android App, I have created different layout versions: sw320, sw480 sw600 sw720
But I notice that many mobile smartphones takes the version of sw320 while they do represent the page differently.
For example when running on the following devices:
Nexus One and
Samsung Galaxy s7
both takes (from some reason) the sw320, Why is that?
And would it be reasnable to add more layout versions to the code?
Nexus One and Samsung Galaxy s7 both takes (from some reason) the sw320, Why is that?
The Nexus One was an hdpi device with a screen resolution of 800 x 480 pixels. Its shortest width is 480 pixels, which is 320dp.
The Samsung Galaxy S7 should be an xxxhdpi device, and its screen resolution is 2560 x 1440. Its shortest width is 1440 pixels, which is 360dp.
Hence, both devices fall within your -sw320dp bucket, given your other buckets.
And would it be reasnable to add more layout versions to the code?
IMHO, you should have fewer versions, not more. You should be using layouts that are more fluid and can adapt to small variations in screen size. Having different layout resources entirely should be reserved for cases where a major change in UI is called for (e.g., the classic master/detail pattern implementation, between phones and tablets).

Android app layout folder name for Samsung Galaxy S Duos S7562

I need to create a layout folder for Samsung Galaxy S Duos S7562 phone which display size is 480 x 800 pixels, 4.0 inches (~233 ppi pixel density)
I found the following tutorial for helping layout creation
http://developer.android.com/guide/practices/screens_support.html
Strange thing is there is not any sample for ~233 ppi pixel density
Please advise.
Nexus S is a 4.0 inches 480x800 device and it's a normal screen size device with a hdpi density. So I guess your device has the same setting, but if you would like to know exactly these two values, you can get them programmatically with a sample app as explained here:
How to detect the android screen size programmatically ( the 4 standard sizes)?
Detecting screen density programmatically, pre-Honeycomb
Anyway, since your device should have the most common size, you can start developing your application putting the layout in the "standard" layout folder: please do not provide a layout file for any possible screen size. The link you have posted is anyway a good starting point to read in order to understand how to manage layouts on Android for different devices.
Of course, if you need to, you could think about having a different layout for the landscape orientation (layout-land folder) or for large or greater devices, like Nexus 7 o Nexus 10, using folder layout-sw600dp. The smallest-width qualifier (sw) is available only on Android 3.2 and above.
This is my suggestion and if you have a more specific issue with a layout please come here and someone will help you.

Android Screen Resolution for xlarge

i developed an android appplication. and i want to test this application for xlarge screens.
when i tried to create an emulator with the following resolutions the emulators are not loading
is there any way to test the application for xlarge screens
I tried with the following resolutions:
hdpi-
1536x1152
1920x1152
1920x1200
xhdpi-
2048x1536
2560x1536
2560x1600
my monitor is Dell-21" with resolution Max-1600*900.
There are specific Android API calls that can, at runtime tell you what density and (small/large/normal) screen size a handset has. However, as a developer we should not need to worry about individual handsets at all. All we need to do is to have ldpi/mdpi/hdpi assets and small/normal/large layouts in the apk. Android internally handles everything.
Dont forget to get an indepth understanding of how Android determines which assets to use and aliasing like this.
The definitions are:
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. (Android does not currently support screens smaller than this.)
Here are some more examples of how this works with real screens:
A QVGA screen is 320x240 ldpi. Converting to mdpi (a 4/3 scaling factor) gives us 426dp x 320dp; this matches the minimum size above for the small screen bucket.
The Xoom is a typical 10” tablet with a 1280x800 mdpi screen. This places it into the xlarge screen bucket.
The Dell Streak is a 800x480 mdpi screen. This places it into the bottom of the large size bucket.
A typical 7” tablet has a 1024x600 mdpi screen. This also counts as a large screen.
i want to test this application for xlarge screens. when i tried to
create an emulator with the following resolutions the emulators are
not loading is there any way to test the application for xlarge
screens
AFAIK you can Only create Emulator With Given Below suggestions with Density
While Creating AVD you will get Below Image. you can only choose from the Below Devices to make your Emulator.
Your Alternative Solution :
However, I need to ensure everything's fine.
Yes you can Surely get what you want.
if you want to Check whether your application runs perfectly on 960x640(Normal screen xhdpi) Device. you can Make Custom Configuration From Below Suggestion.
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations as (if you want Nexus 4).
In ADT21 version you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.
In emulator ie in AVD->Device Definition.You can select and fix any type of resolution. You
can also customise any type of size. Since it takes time to load due to high resolution in
emulator.

dimens.xml in values folder for 7" and 10" tablet, how to?

I have tried with:
values-mpdi, values-land-mpdi, values-hpdi and values-land-hdpi
which works fine in phone's screens, the problem is that it could happen that a 7" tablet takes the value from values-mdpi and a 10" tablet too, but the result is not the same, I guess because of the screen size (although is the same resolution and similar density)
so I tried:
values-sw600dp-hdpi
values-sw600dp-port-hdpi
values-sw600dp-mdpi
values-sw600dp-port-mdpi
values-sw720dp-hdpi
values-sw720dp-port-hdpi
values-sw720dp-mdpi
values-sw720dp-port-mdpi
but the app crashes because it does not find the resource needed....
any help will be much appreciated
thanks in advance
Basically three main device categories exist that Android applications need to support:
handsets (phones)
small tablets (7″ category)
large tablets (10″ and above).
Qualifiers before Android 3.2:
Google’s first attempt at creating qualifiers to separate resources by device was to create a handful of size buckets: small, normal, large, xlarge. Initially, this worked out well as handset devices were in the small/normal category, the first 7″ tablets on the market were large, and the first 10″ tablets were xlarge.
Qualifiers with Android 3.2 onwards:
However, as more and more devices began appearing in the market with new screen sizes and the lines began to blur about where a device might present itself. A new solution to the problem was presented in Android 3.2, in the form of new qualifiers to pick resources based on a devices current width/height or “smallest” width; the latter being a new designation for the devices size by representing it in terms of the width (in density-independent pixels, or dp) of the shortest side of the screen.
Using the new paradigm, it has become common to define small tablets as having a smallest width of 600dp, and large tablets at 720dp, with handsets being everything that falls below that line.
Using qualifiers when minimum support is below 3.2 and target is higher than or equal to 3.2
For applications targeting Android 3.2 or higher as a minimum this new system works well. However, if developers wishing to create an application that runs universal on handsets and tablets are compelled to support a minimum Android version no higher than 2.2, or at best 2.3, then in that case create duplicates of each resource in a directory with the old size qualifier and place it an another directory with a corresponding smallest width qualifier.
E.g. keeping the same dimens.xml file in values-large and values-sw600dp. So the device running on android version lower than 3.2 will take values from values-large and the device running on android version higher than or equal to 3.2 will take values from values-sw600dp
//you need to run this in API level 3.2 and above.
for the <3.2 you need to declare normal values-large and values-xlarge

Problem in screen resolution

I have created an app.During creation i have used Nexus s device for testing of my app.But i want my app to support multiple screen.So for that have created separate layout for small device, medium device and so on as suggested in android support multiple screen documentation.Now my problem arise in maintaining layout for Nexus s device having resolution of 480 x 800 pixels and Samsung galaxy ace having resolution of 320 x 480 pixels (ie HVGA devices) because both these device uses same layout folder not like other small/medium device which take its layout from layout-small/layout-medium directory.So its very difficult for me to manage the layout for nexus s device and Samsung galaxy ace device/HVGA devices,because if i manage layout for nexus s devices than its not fit in HVGA devices, similarly if i maintain layout for HVGA device than its not match for nexus s devices.So how can i create separate layout for these two range of devices,because in the documentation it is given that for devices having resolution of 320x480 mdpi, 480x800 hdpi, etc would used the same layout.So please help me to solve this out.
If you use dp/dip (density independent pixel) units in your layout instead of px, everything should be fine.
Did you use fix size for the width and height in your xml? I think if you want to support different screen resolution, you have to use the standard android code for layout width and height. And be sure to use draw9patch in your images.

Categories

Resources