1

I have a "layout" folder and a "layout-sw1024dp" folder, both with a file layout.xml.

In the "layout" folder, I have an ImageView view with the following dimensions:

android:layout_width="150dp"
android:layout_height="150dp"

In the "layout-sw1024dp" folder, the dimensions for the same ImageView are:

android:layout_width="300dp"
android:layout_height="300dp"

Using GenyMotion, I have two devices with the following dimensions:

  • 480x800
  • 1080x1920

The problem is that the smaller image dimensions are showing on both devices, when the 1080x1920 device CLEARLY qualifies for the 1024 smallest width.

Am I missing something?

heisenb0rg
  • 168
  • 13
  • Which is the size screen of 1080x1920? 1024 smallest width is a density independent pixel dimension, so it changes according to screen pixels and screen wide dimension. – Dekra Oct 17 '15 at 04:49
  • dp = density independent pixels, you show your Genymotion dimensions but what is the density of the emulator (mdpi,hdpi,xhdpi, etc.) – Morrison Chang Oct 17 '15 at 04:49
  • The emulator dpi settings for both is 240dpi, so hdpi. – heisenb0rg Oct 17 '15 at 05:03

1 Answers1

0

Based on the comment above by Morrison Chang, I need to take in consideration the dpi of the emulator (device). I found the following calculation to get the actual smallest width dpi:

How to convert resolution to dpi

Calculate the density:

Density=Square root((wp*wp)+(hp*hp))/di

where wp is width resolution in pixels, hp is height resolution in pixels and di is diagonal size in inches.

Community
  • 1
  • 1
heisenb0rg
  • 168
  • 13