0

I am trying to differentiate layouts in Android (ICS+) for larger devices like the note 3 but finding it next to impossible to do without reading the device name or attempting to calculate physical size in code.

The (deprecated) size attribute for the note 3 identifies as normal, as does the HTC One Mini.

Same goes for using sw350dp / xxhdpi. Not sure if the HTC Mini is the unusual device here, but I would imagine all the newer high-end mini handsets will be the same. I also don't want to use px values if I can help it as smaller devices can (and probably will) go up to 1080p, and notes prior to 3 use lower.

Is there something I am missing here? If not, is any reliable way to calculate the physical size or am I better off hard-coding device lists to provide optimal layouts?

EDIT

So part of this was due to multiple overriding layout folders causing some funkiness and I now have the Mini using the correct values, however I am still in the same situation with the S4 and Note 3 using the same resources. While this is not as bad, it still isn't optimal.

I expect that the Note 1 and 2 will also drop back to the lower DPI resources meaning their real-estate won't be utilised either.

Ben Neill
  • 2,811
  • 2
  • 22
  • 20
  • `sw350dp` is measured in density-independent pixels. "smaller devices can (and probably will) go up to 1080p" -- but they will remain the same size in density-independent pixels. Use `-swNNNdp`, `-wNNNdp`, and `-hNNNdp` for your phablet scenarios. – CommonsWare Nov 21 '14 at 02:46
  • @CommonsWare Yes but I don't see how I will differentiate layouts between physically small and large - things like touch areas become a problem otherwise. – Ben Neill Nov 21 '14 at 02:48
  • "Physically small" = lower number of density-independent pixels. "Physically large" = higher number of density-independent pixels. Choose values that are where you want to change UIs, just as Web designers choose `dp` values for CSS media queries for deciding when to apply certain CSS rules. http://developer.android.com/guide/practices/screens_support.html#range – CommonsWare Nov 21 '14 at 02:52
  • @CommonsWare Essentially I am trying to decide whether to show 3 or 4 columns in a gridview. So in the case of the HTC Mini and the SGS Note 3, they have the same sw dp size and both are xxhdpi - I am not sure how that will help... I *can* show the same layouts on both devices but text and touch areas become too small. – Ben Neill Nov 21 '14 at 02:57
  • "HTC Mini and the SGS Note 3, they have the same sw dp size" -- then they are the same physical size. `1dp` = 1/160th of an inch, for all devices. If they are not the same physical size, either you are doing your calculations wrong, or one of the manufacturers screwed up something with the reported density. – CommonsWare Nov 21 '14 at 23:13
  • @CommonsWare That may be the issue: The HTC Mini is 341ppi, 4.3" while the note 3 is 386ppi 5.7". From what I understand that should put them both in the xhdpi bucket (being under 440ppi). The HTC M7 (which the mini is based on) is 469ppi putting it in the xxhdpi bucket - they have probably decided it looks good with the higher bucket and left as-is for maintainability. The note 3 may be the same story. – Ben Neill Nov 24 '14 at 00:33

1 Answers1

0

Do NOT use screen size approach. Some phablet users who have Galaxy Mega 5.8/6.3 device or Nexus 6 may have unintended experience.

Use resource based approach sw600dp and sw720dp as below link.

Tablet or Phone - Android

Community
  • 1
  • 1
Youngjae
  • 24,352
  • 18
  • 113
  • 198