I have a Nexus 7 tablet which should have a resolution of 1280px by 800px (WXGA). I develop on Eclipse and my layout is set to display at WXGA. Then, I can place my button and object and choose their size according to what I see on the Eclipse display. The problem is that what I see in Eclipse is very different from the display on the tablet. Everything is much bigger on the tablet and it causes me a lot of troubles.
I wonder if someone have an idea about this?
Edit
For some reason it seems like the 7inch WSVGA is the exact replication of my Nexus 7 screen. It is strange since it offers only 964×544 pixels while the Nexus 7 should give 1280x800
WXGA means nothing by itself. You should look at the density too. Nexus 7 is 213dpi (tvdpi) while a Galaxy Nexus is the same res but 240dpi (hdpi).
You should try to detect the screen size that the Android device has and then run code to re-position screen elements accordingly
In Unity scripting you would get the vars Screen.Width and Screen.Height , I'm not sure what the vars are called in normal android , but you would then set your screen elements to react to what ever size the screen it .
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.
I have created an app that works on 10.1 inch tablet. Later I get a 7 inch one and that need some change to adjust for font size ( font as big as in a big screen and also a smaller screen). Now I get a RedMi note phone that is 5.5 inch. The app looks badly and needs big change of the UI screen. What are the best way to adjust for such changes in screen size and resolution?
Also, how should I create an emulator that meet the real device resolution and screen size? How should I pick when there are no one nexus device that match it completely?
Thanks
Please consider the layout, layout-large, layout-xlarge for making all screen compatibility application.
For example,
layout - Mobile screen
layout-large - Tablet below 7 inch
large-xlarge - Tablet above 7 inch
refer this link for more details http://developer.android.com/guide/practices/screens_support.html
For creating the new emulator device, Goto eclipse and
Window->Android virtual device manager->Device defination(tab)->Select device->Create device-> restart the eclipse
The you can see the created device.
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 searched quite a lot here on stackoverflow but could not find the answer)
My game is a tablet-only game and so far I got the interface to fit on a
1024x600 7" tablet mdpi (ex: HTC Flyer)
1280x800 10.1" tablet mdpi(ex:Acer A500)
Nexus 7" v2 xhdpi
Nexus 7" tvdpi
I thought I was near the end but today I had the chance to quickly try it on a Galaxy Tab 3 and the main image on the main layout was stretched and probably didn't use the right resource (I expected it to use the mdpi one as it's a 7" 1024x600 tablet). I read somewhere that the Galaxy tab would be using the hdpi resource. I made some changes and I would like to test it but unfortunately I no longer have access to the tablet.
I installed the Samsung emulator but it targets android 2.2 so I can't run my app on it.
I then tried to create a new definition by specifying 1024x600, Large and HDPI but then the game would crash because the game is checking some values on startup and it could not find the values-large-hdpi folder . Of course I could create the folder/values but on the other hand it was not crashing on the actual tablet so I'm not sure it's the right idea.
So how do you create an AVD that acts like the Galaxy Tab 3 on Android 4.+ ?
I have a requirement in android to support my app in different tablets like google nexus 10 and samsung galxy 10 inch tablet. Nexus 10 is double the resolution of samsung 10 inch tab. I need to place different images for nexus 10 to make my app looks with better clarity for nexus 10 . But both the devices are taking the image from the drawable-xlarge. How can I differentiate between these two devices in drawable level and layout level. Same case is applicable for phones as well where I need to differentiate Samsung galaxy s4 which is double the resolution of xhdpi phones.
-xlarge is a screen size qualifier. Your drawable folders should use screen density qualifiers (-mdpi, -hdpi, -xhdpi, -xxhdpi). If you must, you can use both, e.g -xlarge-hdpi
Don't forget the new smallest width qualifiers. They are of a great help when you need to differentiate based on screen resolution.
I wouldn't consider a non-Nexus tablet anymore, based on how bad manufacturers have been at bothering to update them. The Nexus devices being "Official Google" devices and getting updates from Google means that they're going to be updated for a long while going forward, and once that ends, you can still unlock and root them through a defined process & update things yourself if you care to do so.
I can't think of any 10" Android tablet I'd have other than the Nexus 10. They're really that good.