5

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..

Community
  • 1
  • 1
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159
  • Just a quick question for clarification... Are you testing it on a Nexus 6 running on stock with no modifications? – Kamran Ahmed Aug 21 '15 at 06:09
  • @KamranAhmed I am testing Nexus 6 with following values xxxhdpi,xxlarge,xxxlarge..But always pick default values folder. – Ranjithkumar Aug 21 '15 at 06:16
  • No @ranjith, I am talking about the device that you are testing on. – Kamran Ahmed Aug 21 '15 at 06:19
  • @KamranAhmed I am testing on Android studio -> Nexus 6 preview. – Ranjithkumar Aug 21 '15 at 06:39
  • @ranjith For tablet values-large-mdpi, values-xlarge-mdpi. Please follow anyone structure. – Sridhar Aug 21 '15 at 06:42
  • I confirmed that `values-xxxhdpi` works for Nexus 6 preview perfectly provided with Android Studio 1.3.1, what version of Android Studio are you using? The problem would be clearer if you test it on a Nexus 6 emulator to ensure that it's not a bug in your Android Studio Preview. It is sometimes a case that the preview fails to show the actual preview. If it doesn't work on an emulator too then certainly your issue is what @Sridhar is suggesting. – Kamran Ahmed Aug 21 '15 at 06:55
  • @KamranAhmed My android studio version 1.3.1. I am already using values-xxxhdpi..but Nexus-6 take default values - this is the issue.. – Ranjithkumar Aug 21 '15 at 06:59
  • @ranjith I am not sure about that. But when i write an application for both mobile and tab, I have faced this same issue with Nexus - 6. After that I have removed the values-large and values-xlarge folder. It has worked. I just came to know that when we use both large,xlarge and xxxhdpi then there is a misunderstanding which should be followed. – Sridhar Aug 21 '15 at 07:03
  • @Sridhar I hope your answer works for my issue..But I can`t test now(I am at outer)..I accept the your answer after my testing. thx. – Ranjithkumar Aug 21 '15 at 07:06

3 Answers3

4

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.

Mihir Shah
  • 996
  • 10
  • 19
4

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

Frankenxtein
  • 483
  • 7
  • 18
3

I think you are using both the structure in your application which will make a confusion.

So if you are using values-mdpi, values-hdpi, values-xhdpi, values-xxhdpi , values-xxxhdpi then go with that.

For Nexus-6, you have to use xxxhdpi.

Please remove values-small,values-large,values-xlarge,values-xxlarge.

Supporting all screens In this page, check the table 1 for understanding about screen characteristic.

Hope it will help you.

Sridhar
  • 668
  • 1
  • 11
  • 22
  • The thing is you have two kind of structure for dimensions and you have to follow anyone. If you are completely following anyone way then make the folder name according to that. Otherwise it will make a confusion that which should be followed? Please accept the answer if it is helpful. – Sridhar Aug 21 '15 at 06:49