سؤال

I have read lots of post on this forum and others about using a different layout depending on the device being used.

Below is a screenshot of my layout folder at the moment:

Layout folder

Now, I have tried many different variations to try and get the XML layout to change. The project is designed using a phone and I'm now testing on a 10.1 inch Samsung Galaxy tablet.

Despite all those layouts my app still uses the default .xml file.

Any ideas where I'm going wrong or other variations to try?

I should say I lock the user into portrait mode hence a few layouts with -port.

Any help would be great

thanks

هل كانت مفيدة؟

المحلول

You need to have your layout-large, layout-sw400dp-port,... folders at the same level as your layout folder instead of having them inside the layout folder. Your folder structure should look like -

/res/layout/
/res/layout-large/
/res/layout-sw400dp-port/main.xml 
...
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top