1

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?

Pavel Petrashov
  • 257
  • 1
  • 4
  • 13
  • Only one solution,try diff sizes and run in your phone.Check whichever seems to be good,use that size finally. –  Apr 01 '15 at 04:06
  • I'm doing. but the rest of the phone is already on display in the dpi and everything is fine. – Pavel Petrashov Apr 01 '15 at 04:09

2 Answers2

2

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.

random
  • 10,238
  • 8
  • 57
  • 101
  • excellent article. that's cool. but the question is the same in another. How do I specify the correct spacing, height, buttons etc? if I point out in the dpi all drawn crooked – Pavel Petrashov Apr 01 '15 at 04:22
  • i have some problems with LG G3 mini (294 dpi) – Pavel Petrashov Apr 01 '15 at 04:25
  • I feel I was stupid. my design 1440x2560 - xxxhdpi. 100px(xxxhdpi) = 25dpi. 50px(xxxhdpi) =12.50dpi. I have these values and they work on all phones except the nexus 6 and LG G3 mini. if I point 28 x14 dp then the rest will be all crooked phones – Pavel Petrashov Apr 01 '15 at 05:29
  • you can create a separate dimens.xml file for the two phones that are causing a problem – random Apr 01 '15 at 05:44
  • Could you give an example of how to do it? – Pavel Petrashov Apr 01 '15 at 05:46
  • Read more about the file here: http://developer.android.com/guide/topics/resources/more-resources.html#Dimension - create different dimens xml say at res/values/dimens.xml for normal values and res/values/sw400dp-xxxhdpi/dimens.xml (the smallest width of the device, taking the minimum of the landscape and portrait widths is 400dp or wider in xxxhdpi) for nexus 6 – random Apr 01 '15 at 05:56
1

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?

Community
  • 1
  • 1
Jim
  • 10,172
  • 1
  • 27
  • 36