-2

Please Read the question carefully before marking it as duplicate I have tried this SO Layout folders for Google Nexus 7 and 10, didn't worked for me.

I am developing an app which should work on both tabs and phones. I've created following resource directories: layout-mdpi, layout-hpdi, layout-xhdpi, layout-xxhdpi, layout-xxxhdpi, layout-sw600dp, layout-sw600dp-land, layout-sw600dp-land-tvdpi (for nexus 7 land), layout-sw600dp-tvdpi (for nexus 7 portrait), layout-sw800dp, layout-sw800dp-land, layout-sw720dp, layout-sw720dp-land

**same for drawable and values

my problem is that in Nexus 10 it always takes from layout-xxxhdpi (which is certainly not for tab) instead of layout-sw720dp and layout-sw720dp-land.

Is there any way to create a separate folder for nexus 10?

I already have tried these with no result:-

layout-sw720dp-land-xhdpi

layout-sw720dp-xxhdpi

Community
  • 1
  • 1
Rivu Chakraborty
  • 1,372
  • 2
  • 12
  • 37
  • 1
    That you need so many different layout directories indicates a deeper problem with the code. Especially the resolution dependent layouts are strange. It seems you are on the wrong track here. – Henry Aug 02 '16 at 05:34
  • @Henry If you think that I'm on the wrong track then can you please guide. My app has separate designs for tab and phone. – Rivu Chakraborty Aug 02 '16 at 05:38
  • I don't know who has contributed the minus vote but can you please explain the reason? – Rivu Chakraborty Aug 02 '16 at 05:39
  • That's hard without knowing any details. But if you specify measurements in dp there should be no need to have `layout-mdpi`, `layout-hpdi`, ... . Typically, maybe 4 different layouts should be enough (phone, phone landscape, tablets, tablets landscape). – Henry Aug 02 '16 at 05:43
  • @Henry for phone I have 5 different resolutions to support (no need for landscape). So I have 5 for phone – Rivu Chakraborty Aug 02 '16 at 05:45
  • The layout itself can be the same on all resolutions if done correctly. Layout is mainly dependent on screen size and orientation. On the other hand drawables are typically dependent on resolution. – Henry Aug 02 '16 at 05:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/118866/discussion-between-rivu-chakraborty-and-henry). – Rivu Chakraborty Aug 02 '16 at 05:56

1 Answers1

0

Possible solution is to go by screen size - layout-large and/or layout-xlarge.
Once I developed for highres tablets (10"), I had to go with layout-large.

Also you pretty much don't that number of directories, research about RelativeLayout, wrap_content, match_parent and density pixels