-1

I followed this article from official documentation: https://developer.android.com/guide/practices/screens_support.html#qualifiers

I added a folder name "values-hdpi"; inside I have "dimens.xml" with several size definitions.

I start on Google Nexus S (480x800): it's good, the sizes taken are in the folder "values-hdpi".

I start on Samsung S5 (1080x1900): it's failed; the sizes taken are always in the folder "values-hdpi" rather than into the standard folder named "values".

Could you help me?

Thank you very much guys

anthony
  • 7,653
  • 8
  • 49
  • 101
  • 1
    from the doc in the link you provided, just above is a paragraph stating : "However, when the system is looking for a density-specific resource and does not find it in the density-specific directory, it won't always use the default resources. The system may instead use one of the other density-specific resources in order to provide better results when scaling." So if you don't have resources available for S5 xxhdpi (~480dpi) than android will pick one which "fits the best" – halfred Dec 20 '16 at 12:54
  • Perfect ! I created other "values-XXX" according density. Thank you very much ! – anthony Dec 20 '16 at 13:10

2 Answers2

0

According to:

Android hdpi/mdpi/ldpi for Values folder?

res/values/dimens.xml(default)
res/values-ldpi/dimens.xml   (240x320 and nearer resolution)
res/values-mdpi/dimens.xml   (320x480 and nearer resolution)
res/values-hdpi/dimens.xml   (480x800, 540x960 and nearer resolution)
res/values-xhdpi/dimens.xml  (720x1280 - Samsung S3, Micromax Canvas HD, etc) 
res/values-xxhdpi/dimens.xml (1080x1920 - Samsung S4, HTC one, etc)
res/values-large/dimens.xml  (480x800)

res/values-large-mdpi/dimens.xml (600x1024)
res/values-sw600dp/dimens.xml  (600x1024)
res/values-sw720dp/dimens.xml  (800x1280)
res/values-xlarge-xhdpi/dimens.xml (2560x1600 - Nexus 10")
res/values-large-xhdpi/dimens.xml  (1200x1920 - Nexus 7"(latest))

So you could try creating values-xhdpi and other values also.

Community
  • 1
  • 1
gi097
  • 7,313
  • 3
  • 27
  • 49
0

There is no need to use separate dimens.xml for different screen densities. If you use the "DP" units (density-independent pixels), Android will automatically convert it to PX according to the device's screen density.

Miloš Černilovský
  • 3,846
  • 1
  • 28
  • 30