Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android values folder for Nexus 6

My problem:

I'm developing an android application and I'm having trouble with the layout on nexus 6 phones.

I don't know which values folder would be applicable to best match nexus 6.

Details about Nexus 6:

density - 560 dpi

Screen display - resolution of 2560 x 1440 (493 ppi).

What I have tried:

Nexus 6 and Nexus 9 Screen density

http://android-developers.blogspot.in/2014/10/getting-your-apps-ready-for-nexus-6-and.html

My res-values structure:

  • values-small (0.75)
  • values (1.0)
  • values-large (1.5)
  • values-xlarge (2.0)

I am also try the following dimens values.

  • values-xxxhdpi(3.0)
  • values-xxlarge(3.0)
  • values-xxxlarge(3.0)

My AndroidManifest.xml

<supports-screens
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:anyDensity="true"
    android:resizeable="true"/>

But always picks the default dimens values(1.0)..

Any body solve my problem..Thanks..

like image 645
Ranjithkumar Avatar asked Aug 21 '15 05:08

Ranjithkumar


2 Answers

The values folders are usually qualified on basis of smallest width (sw360dp) or width(w360dp) instead of screen density (mdpi, hdpi etc) to maintain density independence.

For example, folders as:

values-sw320dp
values-sw360dp
values-sw600dp

This is because by giving dimensions in dp, it would automatically resize in form of pixels on different screen densities. With following convert ratios:

mdpi - 1
hdpi - 1.5
xhdpi - 2
xxhdpi - 3
xxxhdpi - 4

Screen density qualifier is preferred with drawable folders, as the image files are in pixels.

Nexus 6 has smallest width 360dp (configuration 360dp * 640dp) and xxxhdpi screen density. You can try using folder values-sw360dp for Nexus6.

like image 147
Mihir Shah Avatar answered Sep 18 '22 16:09

Mihir Shah


In Android Studio, nexus 6, 5x and 6p, all three devices use dimensions from values-sw400dp folder.

like image 26
Frankenxtein Avatar answered Sep 20 '22 16:09

Frankenxtein