How to control resolution screen size - android

I'm a new dev of android and I can't control the resolution of the size for screen phone.
I created 2 emulations phone: Pixel 2 1920x1080px 5inch and Nexus 4 1280x760px.
I also created the layout resource w480dp.
When I run test the layout, it only change on pixel 2, the Nexus 4 doesn't change. I also run test on real phone (Galaxy S3), the layout is not same with Pixel 2
So I would like to ask the helping how do I control the resolution screen size.
I've already read on Google help about small, large... but also can't control in this case.

you can use this library for setting same screen for different device.
SDP - a scalable size unit

Related

how to choose an android emulator that match real device

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.

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.

Not fiting real resolution

I'm working with a board wich has android 2.3 as base SO. This board has connected an 7" screen and I¡m using this set to develop an app.
While developing this app on eclipse, I'm using RelativeLayouts. This app will only be for an especific screen size, so for the moment I don have the need to use diferent resolutions to fit other screen sizes.
The problem that I'm getting is that I have developed all this program using on eclipse a 7" screen base, but when runing the app on the board, the layout doesn't fit the screen. It makes the same effect as if you create a layout fitting a 7" screen with RelativeLayouts, and then you change this resolution to 5.4". The layout gets oversized and doesn't fit well the screen.
So, what would be the problem? As i said, the screen is 7" and I'm developing for 7". I don't know why happens this.
Its simple, the pixel density of your board is different from the pixel density of your emulator (on eclipse).
I am assuming you did not set a "fixed" size on your images and layouts, only selecting match_parent for width and height, right?
What is happening is that android is scaling (or not) its resources based on your screen pixel density, and that gives you the difference between the emulator and the board.
Screen size does not means equal screen pixel density, and that can cause you a lot of trouble if you do not manage this correctly providing different resources and qualifiers.

why the emulators have different sizes than the mentioned ones

Why some devices are for example 2.7 inches and when you launch the emulator the real size is not 2.7 inches..?
Edit:
And will the display on that screen be like the real display or will it differ on real devices?
You can start the emulator to have the same number of pixels or to have the same size as the real device. You cannot have both since the density of your screen in general differs from the density of the device.
If you specify to have the same size and the actual size still differs, then your OS did not correctly recognize the density of your screen.
The density of the screen on the development machine is normally lower than the one of the device. A pixel perfect emulation of the device screen will therefore only be achieved when you choose the same pixel size. But then, the emulation is very good since the emulator runs the same code and operating system as the real device.
This you can set while launching the emulator. You will get an option of scaling display to real size but that will appear very small on your computer screen. So better use the default size which fits to the screen.

Will samsung GS 4 be a Large or Normal sized device for Android layout purposes?

The upcoming Samsung Galaxy S4.
Reported Specs:
1080 x 1920
4.99 inch diagonal
If I plug that into a new Device definition in AVD, the resulting device size is listed as "Normal" and the Density as "xxhdpi", screen ratio long.
However if I put in a diagonal of 5.00 inches the size changes to "Large".
What to tust?
More generally: Does the AVD device manager match exactly the logic used on Android devices in determining what layout bucket to pull from (unless manufacturer overrides)?
Edit: note regarding the above sentence: When you enter the diagonal and screen dimensions the AVD dropdowns will automatically configure themselves according to those values.
And please oh please don't direct me to the dreaded "Supporting Multiple Screens" page which does not give exact logic.
Will samsung GS 4 be a Large or Normal sized device for Android layout purposes?
You will know when everybody else knows, when the device ships. Samsung can choose whatever it wants for the screen size.
Does the AVD device manager match exactly the logic used on Android devices in determining what layout bucket to pull from (unless manufacturer overrides)?
No, the "AVD device manager" uses whatever screen size bucket you chose when you created the device definition. There is a drop-down listing the various choices.

Categories

Resources