سؤال

I have question about orientation. I started with an application for a phone. I just wonder if it is possible to make the layout in 2 different xml files. Currently I have the layout right for vertically but not horizontally. I wondered if it is possible to make two layouts files one for vertical and one for horizontal.

Thanks,

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

المحلول

Yes It is possible..You just have to put it under separate folders with different names depending on orientation and resolution, the device will automatically select the right one for its screen settings

More info here:

http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/training/basics/supporting-devices/screens.html

Put them under "Resource directory qualifiers for screen size and density"

You will have to create two versions of xml files and put in layout-port and layout-land folder inside res folder.

eg :

res/layout-land [Landscape Mode]
main.xml 
res/layout-port [Portrait Mode ]
main.xml

نصائح أخرى

Yes it is possible..while making a XML file in android..u can specify the size of the XML layout as well as orientation and many more properties..u can learn more at the developer.android page..the name of the XML remains the same..but the file gets created in a different folder..

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top