I want to know the screen size of an Android phone (without using code)
For example: I find that from specs someone has a device with 1080 x 1920 pixels (~445 ppi pixel density)
How would I go from here to figure out which layout his or her phone will support?
From this document, I got:
lpdi = 120 DPI
mdpi = 160 DPI
hdpi = 240 DPI
xhdpi = 320 DPI
xxhdpi = 480 DPI
xxxhdpi = 640 DPI
And this rough estimation below which seems so ridiculous.
Where does the DPI fall, if it is 215 for example?
I want to know the layout size to choose for a particular device that I don't own:
Whether the layout be should be small, medium, large, or extra large ?
There's a bit of confusion between dpi and ppi.
The correct term should be ppi, but it's dpi by convention.
So, roughly, we can assume that ppi = dpi, for our purposes.
For your reference: http://www.fastcodesign.com/3039564/the-difference-between-ppi-vs-dpi-explained-by-a-google-designer
445 ppi falls in the 480 dpi normalized bucket. 215 ppi falls in the 240 dpi normalized bucket.
I used the term "bucket" improperly: I should have said "range", to be more clear.
How would I calculate the ranges?
I'd say that the range starts from the median between (320 and 480) + 1 and ends at the median between 480 and 640.
Therefore, for the 480 "bucket", I calculate a range between 401 and 560. And 445 falls here into.
Note: it's all empyrical.
The proposed figure on the Android developers site is a poor representation of the concept.
I prefer to imagine those buckets like adjacent funnels with a "mouth" which is 160 dpi wide and an end which points to a normalized value.
Here's an image I prepared just to make it even more clear:
Related
I have design for my project. It for Nexus 6 with resolution 1440px x 2560px and 493 ppi. My design - 1440px x 2560px.
I know that:
ldpi 120 dpi
mdpi 160 dpi
tvdpi 213 dpi
hdpi 240 dpi
xhdpi 320 dpi
xxhdpi 480 dpi
xxxhdpi 640 dpi
I have - 493 ppi. what's this? I have a button size 100x50 pixels on the design.
how many dpi need button to look as well as in the design?
Hope this helps: Getting Your Apps Ready for Nexus 6 and Nexus 9
Nexus 6
Screen
The Nexus 6 boasts an impressive 5.96” Quad HD screen display at a
resolution of 2560 x 1440 (493 ppi). This translates to ~ 730 x 410 dp
(density independent pixels).
Check your assets
It has a quantized density of 560 dpi, which falls in between the
xxhdpi and xxxhdpi primary density buckets. For the Nexus 6, the
platform will scale down xxxhdpi assets, but if those aren’t
available, then it will scale up xxhdpi assets.
EDIT:
Consider this line
2560 x 1440 (493 ppi). This translates to ~ 730 x 410 dp (density
independent pixels)
It implies the scaling factor is 2560/730 = 1440/410 ~ 3.5
For a screen of width 410 and height 730 in dp, if you want to specify a button of half the screen width in dp, the width should be 410/2 = 205 dp which translates to 717px = 205*3.5 (width in dp * scaling factor)
A button of size 100px x 50px would translate to 28 x14 dp (100/3.5 * 50/3.5) on a 410 x 730 dp screen size.
If you are genuinely concerned about proper display resolution (which it sounds like you are) then you should never rely on the generic folders. The folders are there for generalized purposes - not for customized or high value display.
You should use displayMetrics to measure the screen size and select the appropriate asset, or even do customized image scaling. There are a lot of resources around this set of properties, but essentially it allows you to address the issue you are facing: set appropriate margins, padding, resolution, layout, etc. for a highly customized display.
Here are the docs:
http://developer.android.com/reference/android/util/DisplayMetrics.html
And then some "simple" implementations of getting the metrics:
How to get screen display metrics in application class
getting the screen density programmatically in android?
I get my android phone screen density 240 dpi using DX Toolbox:
Screen density
240 DPI
but the screen density is PPI (pixels per inch) I known.
Which one can be used to describe the screen density?
DPI and PPI is the same. Dots per inch vs points pixels per inch. Do not confuse DPI with dip (density independent pixels).
Edit:
I was suggested PPI means pixels per inch, which seem right.
Further reading (from polish wikipedia) suggests that DPI is incorrectly used in this context and it should be used in context of printing.
Also point in typography is equal to 1/72 of an inch.
How do I know how much DPIs a device has (and thus if it's ldpi / mdpi / hdpi / xhdpi, - and screen size, which is also measured in dp - xlarge / large / normal / small - according to http://developer.android.com/guide/practices/screens_support.html)?
I know the device's resolution and diagonal size, for example:
Display TFT LCD, 3.5 in (89 mm) diagonal.
320×480 px HVGA with Gorilla Glass
16M colors
(Taken from http://en.wikipedia.org/wiki/Samsung_Galaxy_Ace)
Don't need it programmatically, just to calculate myself.
Use DPI calculator to calculate dpis, and Figure 1 in the dev docs to determine whether its ldpi, mdpi, etc.
I think DPI reffers to printers... IN your case DPI = PPI. Please correct me if i'm wrong [edit: I'm wrong :P]
'So a 1200 dpi printer uses 1200 dots of ink in every inch to make up the colours. If you were printing a 300 PPI image, then every pixel would be made up of 16 smaller ink dots (1200 DPI x 1200 DPI / 300 PPI x 300 PPI). A lower DPI would have fewer ink dots making up each pixel, which would make the colour look worse. A higher DPI would have more ink dots for each pixel and should give more accurate colour (especially under close examination).'
I am trying to emulate the size of a Galaxy Note screen, which is 1280 * 800 resolution and 285 ppi. But when i try to enter device configuration on Eclipse for Android, I have to enter xdpi and ydpi values (1280 * 800 ?), not ppi ones. I have the possibility to enter the density, but I only have the choice between : X-High Density, High Density, TV Density, Medium Density, and Low Density. I guess I have to choose X-High Density but how to be sure it is equal to 285 PPI ?
Do you know how to find the dpi informations to enter in order to have the same visualization ?
Thanks in advance !
You can compute the xdpi and ydpi
xdpi = 800/x-dimension of screen in inches
ydpi = 1280/y-dimension of screen in inches
I noticed that the device dimensions are about 3.3" x 5.8" so then (xdpi,ydpi)=(242,220)
From this, we can double check whether this results in the given ppi by sqrt(xdpi^2+ydpi^2) or 327 which is, unfortunately, quite far off of the given 285ppi (and I don't know why right now).
We can scale both xdpi/ydpi with 15% to (210, 190) which results in a ppi of 283.
But again, I would like to understand why this is needed.
But for your purpose, I guess that xdpi,ydpi=(210,190) would be a good match
So I create sets of assets for an Android UI - 320 x 400 & 480 x 800 both of these at 160 and 240 dpi...
After Drawing some of the assets as 9 patch a weird thing happened. The 9 patch graphics all 'came out' as 72 dpi but with different dimensions!
So my conclusion is that android asset creation works similiar to iPhone. Creatings assets to dimensions and ignore DPI (using 72 as a base - as this is what the 9 patch programme converted them too!) RIGHT?
Anyone else experimented with this?
Just think for a minute about what DPI is. Dots per Inch. For displays, it's actually Pixels per Inch, or PPI.
A 320 pixel wide image at 160 pixels per inch is 320 pixels wide. How many pixels wide is a 320 pixel image at 240 pixels? The PPI density only matters on the actual output device. Your display has a fixed number of pixels at a fixed physical size. The number of pixels that fit into 1 inch is its PPI density. The reason this is modifiable for graphics is for when the density can differ. Most commonly, this is for printing (which is where the dots come in). Most printers can print at a variety of resolutions. The typical is something like 300 dpi for images, 1200 dpi or higher for vector graphics and line art. When you set the dpi before printing an image, it tells the printer how many dots per inch it should lay out. The higher the dpi, the sharper the image -- assuming the input image is actually large enough to accomodate this resolution.