I have written an android app and have tested it for all kind of screen sizes and densities (Using the android emulator). I have also tested the layout for relatively small screen sizes, for example the WQVGA device (3,3", ldpi, 240 x 400)) and it's working fine. I have two physical devices (sony z3 compact with 4,6" and sony xperia v (4,3"), which display the layout in the correct way. Lately a friend came over and i wanted to show him the app on his smartphone (sony galaxy s2 plus (4,3")) and the layout was totally destroyed, meaning that the display seemed to small. TextViews and buttons weren't displayed properly.
I don't really understand this. All those devices are in the category "medium". And the screen size of the S2 Plus is equal to the one of the Sony Xperia V (and even a lot bigger than the WQVGA). So why does this device display my layout properly. I want to use the old size-qualifiers (small, medium, large, xlarge), because i target api-level 11.
How can i solve this issue? I don't want to redesign my layout for medium-devices, since it really looks the way i want it to look on all the devices, which work properly.
Actually you are confused between resolution & screen size.Galaxy S2 Plus & Sony Xperia V have same screen size but their resolution are different 480*800 pixels & 720*1280 pixels respectively.So both device are under different resolution so your application supports xhdpi & ldpi but doesn't in
hdpi.You should provide support for hdpi.For more clarification you should provide code.
For more reference refer:
1.http://android-developers.blogspot.in/2009/10/support-for-additional-screen.html
2.http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
3.http://developer.android.com/guide/practices/screens_support.html
Related
I have multiple layouts to support different screen sizes:
layout-sw320dp (smallest phones, 4.0" and smaller)
layout-sw360dp (approximately 4.7-5")
layout-sw400dp (most phones right now, 5-6")
Note: This values are from Design tab in Layout Editor from Android Studio.
(Example for layout-sw320dp)
First layout (layout-sw320dp) for small screen sizes was designed in Android Emulator on Nexus S
Second layout (layout-sw360dp) was designed on a real device Samsung Galaxy A3 2017 - 4.7''
Both of them works! Every layout is called according to phone screen size: layout-sw320dp on Nexus S which is 4.0' and layout-sw360dp on my phone which is 4.7".
My problem arises with layout-sw400dp which should be called on devices with 5" and bigger. For this layout I have another real phone Samsung Galaxy S7 edge - 5.5" but on this phone, the app is calling layout-sw360dp instead of layout-sw400dp. This occurs only on my real phone. In Android Emulator on Pixel XL (which has the exact same specs of screen as S7 edge - 5.5" and the same resolution) the app call the right layout.
Update: Example for layout-sw400dp
My questions are: Why is this happening? How can I solve this that phones with 5" and bigger call other layout than layout-sw360dp?
Samsung S7 Edge is a 5.5 inch phone and it falls under sw360dp category
That means, everyting is working as it should be
link https://material.io/tools/devices/
The point is, DP doesn't depend solely on screen side, it depends of the sreen size and how many pixel the display actually has.
Designing for multiple phone screen sizes
There are out there thousands of android devices with different screen sizes, resolutions and densities. So what should you do when designing layouts that should supports almost every size of Normal android device? (Samsung Galaxy J5, Nexus 5, etc (Not tablets))
How to support different size of phone screens? (Samsung Galaxy S6's screen size is 5.1" screen size, 1440x2560p screen resolution) and all the other phone screen sizes.
Because when you make an layout with 2 ImageViews and a single TextView, and then review it on example. Samsung Galaxy J5, it looks fine. Then you review/download it on another phone that is example. Samsung Galaxy S5, some of the things are in the wrong places and you definitely think that the TextView should be 56dps on the left...
How to do another layout for another screen size?
*Note: I only asked about How to support multiple Normal Phone sizes? Not about "How to support all the devices (TABLETS, PHONES, WEARS)?"
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.
I'm currently working on my application, which tries to support different screen resolutions but I noticed a major problem with my layouts. I'll explain:
I have two folders in my res folder. They are called "layout" and "layout-sw360dp" which is meant to support big screens like Samsung Galaxy S4, HTC One, etc.
Now, when I try to run my application on my private phone, galaxy S4, the app looks fine and all of the images and the components are perfect.
But when I try to run my app on an HTC One device, suddenly the layout looks small, like very small. It supposes to fit the entire screen, like in my galaxy s4.
It's like HTC One and Galaxy S4 don't use the same layout folder, although their screens sizes are almost the same.
If you guys can clarify this matter for me I would really appreaciate that.
Edit: I have tried to run my app on an Samsung Galaxy S5 device and it looks find, like the way it should. What is the problem with HTC One?
Physical size is usually measured in inches, it simply tells you the real device's screen size
dpi, is NOT correlated with it. Dpi expresses screen density, how many pixels are shown in a given area (usually a square inch). It could be considered as a measure of screen quality.
Resolution is given by the product of the two; it expresses the total number of physical pixels on a screen.
android:anyDensity="true"
Samsung Galaxy S4, HTC One have different physical size : DIFFERENCE
Refer this for how to choice best resolution : DOC
I am developing an Android application intended for high end handset devices like Galaxy S3, Galaxy Nexus, Xperia V etc. Now I want to know which layout is suitable for devices with resolution 720x1280, density xhdpi and size normal.
I already tried layout-xhdpi-1280x720 and Galaxy S3 device is loading screens from here, but not Galaxy Nexus.
I have tried layout-sw260dp but Galaxy Nexus emulator do not loading screens. Also Nexus7 is emulator is loading from here. I don't want any tablet to run my app.
What can be the problem ? Does Device definition of Galaxy Nexus causes the problem ?
I am using Android SDK 4.2.
Now I want to know which layout is suitable for devices with resolution 720x1280, density xhdpi and size normal.
res/layout/ works nicely. If you are also supporting -small screen devices, have an additional res/layout-small/ for those. You may or may not also wish -land variants (e.g., res/layout-land/) if you want different layouts for different screen orientations.
I already tried layout-xhdpi-1280x720 and Galaxy S3 device is loading screens from here, but not Galaxy Nexus.
That approach has been deprecated for years.
I don't want any tablet to run my app.
Then specify the appropriate <compatible-screens> element in your manifest, to state that you only support small and normal screens, not large and xlarge. This has nothing to do with your choice of layout resource directory.