Вопрос

I have been creating some tests today to check how w qualifier works in android. My idea was that I wanted different layouts for smaller or equal to 320dp, smaller or equal to 480dp, and smaller or equal to 720dp screens. I have this 3 folders in eclipse (layout-320dp, layout-w480-dp and layout-w720dp). The problem is that when I previsualize the layouts with differnt screen configurations I see android not using the expected layout. Some examples:

  1. Nexus One with 480x800 should take layout in w480 but it takes the one in w320
  2. Nexus S with same resolution does same thing
  3. Nexus 7 with 800x1280 should take layout in w720 but it takes the one in w480

Could anybody guess what is happening?

Thanks in advance.

Это было полезно?

Решение

If I'm not mistaken you need to use layout-sw720dp etc etc, going by screen width.

I assume you have calculated the correct pixel to dp for these screens. For exmaple, I have a Nexus 7 and I know it takes drawables and layouts from layout-sw600dp not 720dp. 720dp is for 10 inch screens. Work from screen width. Your error here is picking the wrong folder.

Of course look here too because it is packed with information, it will provide everything you need: http://developer.android.com/guide/practices/screens_support.html

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top