I would like to test my app-layout with different resolutions. Therfore I created an emulator-device with a resolution of 480x832 (the same as my motorola droid/milestone).
I did all my layout_width with "fill_parent" or with dp - but what looks good on the device (e.g. filling up the whole width) is much too small in the emulator. fill_parent works, but layouts with dp are a lot different.
What am I doing wrong?
Thanks a lot!
As Asahi pointed out in the comments, the density of the screen is also important. You should set that to 240, the density of the Droid. However, it is hard to emulate a phone screen exactly on a monitor because the monitor has a much lower pixel density. Therefore, your emulator will look very large in comparison to the actual device.
This article goes into more details on handling multiple screen sizes in the emulator.
Related
Also when I change the DPI to a lower value, everything becomes smaller. Aren't they supposed to get bigger?
OK, I got the answer. I'm posting it here for someone else with the same doubt.
The purpose of the DPI setting is to make sure things aren't too large or too small depending on your screen size vs resolution. A larger device, like a tablet with the same screen resolution as your phone would have a lower DPI screen since it's bigger. If your phones screen was the size of a tablet all the stuff on it would look huge if you kept the same dpi. A lower DPI makes things smaller and allows this tablet to show more stuff on the screen at once.
I developed my application specifically for 10" tablets.
I used DP mostly, and some weighting for other elements, however; I'm unable to use an AVD but I have my Nexus 4. The UI looks gigantic on my phone, due to the DP. Is there any way to scale DP without rewriting my code? Some sort of manifest scale?
Thanks.
No. There's no way. I advise you to run the emulator with a big screen (10') and a lower DPI. (QVGA for example), you might find it possible to work with it that way, and it will reflect good the app dimensions.
I've got a design list for 480x800, 1024x600, 1280x800. How do I ask android to use exact markup based on user screen's resolution ?
As far as I know there're only abstract means(hdpi,xdpi) for solving resolution difference.
How do I ask android to use exact markup based on user screen's resolution ?
Talented developers don't do that. Talented developers realize that only a percentage of Android devices run at the resolutions listed above, just as desktop Web browsers do not run at only three window sizes. Talented developers work with the graphics designer to come up with fluid layouts for different screen sizes (e.g., -normal, -large, -xlarge), which may or may not run at the aforementioned resolutions. For example, there are devices with screen sizes ranging from 4" to 7" that run at 800x480, and there are devices with screen sizes from 4.5" to 10.1" running at 1280x800 (or thereabouts).
As far as I know there're only abstract means(hdpi,xdpi) for solving resolution difference.
-hdpi and -xhdpi have nothing to do with screen resolution. They are for screen density. Density is independent of resolution, and density is largely independent of size.
Create folder based screen width or height. For example
res/layout-w480dp, res/layout-w1024dp, res/layout-w1280dp
Or
res/layout-h800dp, res/layout-h600dp
Read more here, Table 2. Configuration qualifier names.
Afaik, you can markup the layout folder by that is the minimum required screen resolution for the layout you can set one to min600 and one to min 800.
I think this markup scheme is supported in honeycomb and above and since these are tablets resolutions, they will have either anyway.
see this and this
This is might seem to be a sort of silly question to ask but I would like to know while testing our apps what is the best resolution to be used (HVGA/WVGA/QVGA?etc)?
I ask this because I want the layout and the performance of the device to be consistent across most screen sizes.
There is a regularly updated diagram with the screen sizes and densitys available at the android developers site:
Source
This doesn't tell you an exact resolution, but seperates all phones into 4 sizes (small, normal, large, xlarge) and densities. This should give you a hint at least.
The biggest chunk is obviously Normal/hdpi, I guess that should be a lot of 3.7" HDPI displays with a 480x800 resolution (or at least close to this res). Like the Nexus One or HTC Desire (there are sure some newer ones, but I only keep an eye on the market when I'm searching for a phone to buy).
You can use all resolution to test your application, because some phones have QVGA resolution, some HVGA or WVGA resolution. Tablets have others resolutions.
More informations : http://developer.android.com/guide/practices/screens_support.html
If you use the dp unit for the sizes of your screen elements, then you shouldn't need to worry (as much) as this is a relative size, based on the pixel density of the screen.
From your experience as an android developer what emulator screen sizes do you use?
Are there a couple that tend to catch most UI sizing issues or do you test your app in every size and density?
While coding, try to cover at least one of each from this table: http://developer.android.com/guide/practices/screens_support.html#testing . After most of the work is done, I would suggest try every combination you'll find in real devices you plan to deploy your app.
My very basic list while I am designing the UI is:
WQVGA 120 dpi
HVGA 160 dpi
WVGA 160 dpi
WVGA 240 dpi
Add 480x640 240 dpi if you want to support small screens.
You can use the pie chart here to have an idea of relative screen size usage: http://developer.android.com/resources/dashboard/screens.html
BTW, I have use AVDs from Donut to Gingerbread also.
At some point, I test on every size and density that I intend the app to run on. It's irresponsible not to do so.
But beware of densities; because of dpi scaling, you may be running what you think is an hdpi emulator, but the emulator is loading mdpi resources (or vice versa). It's a good practice when testing to log the reported density during onCreate of your launch activity. (My approach, though, is to use an app icon for each density that displays the density, at least until I want to test the real app icons. That way I can tell from the home screen what the emulator thinks it is running.)
you should test your app in every size , in order to be sure that your app will work fine in every android phone ;
and for density , try to create your UI with dip :)
hope it helps