Problem in screen resolution - android

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.

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).

Same layout looks different in devices which have the same screen size

I have 2 phones: Samsung s6 edge+ and Samsung note 4.
Both have the same screen size (5.7 inch) and the same screen resolution (1440X2560).
Both have xxxhdpi density.
Still the same layout looks different on both devices.
even the top status bar and action bar also looks different on both devices.
Can anyone suggest any solution to have the same UI on every Android device?
Screen Sizes also depend largely on its PPI resolution and depends on ppi the android app select the drawables to get the icons or images so you need to check the ppi of devices

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.

issue in layout related to multiple screen support

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.

Distinguish design layout for galaxy S3 and galaxy Note

How to make layout for galaxy S3 (720x1280 pixels) and galaxy Note (800x1280 pixels).
both are extra high density devices so i need to put two set of images for both devices in same folder drawable-xhdpi.
I dont know how device will detect different different images for both devices because both are from same folder.
please tell me how to make layouts or manage layouts for these two devices in a same application.
Thanks in advance.
You can distinguish between the devices using the -sw<N>dp qualifier, which discriminates devices based on their smallest-width attribute.
In your case, you will probably want to add a new folder called drawable-sw400dp. Drawables in that folder will qualify only for devices with a smallest width of 400dp or greater. Since the Galaxy Note is xhdpi with a smallest width of 800px, it will qualify where the S3 will not.

Categories

Resources