Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could a layout exist only in layout-land folder?

My application is forced to work only in landscape mode (EDIT: I mean, the activities has android:screenOrientation="landscape" in the manifest). So, I have the layouts in the layout-land folder, and there is not a same named resource in the default portrait folder.

Sometimes, when I left my device alone for few minuts and I wake it up, I get a forced close, showing a "not resource found" in the setContentView method.

I am guessing that in some conditions, android is looking for a portrait resource before noticing that it only needs the landscape layout. Is always mandatory to have a layout resource in the default portrait folder?

EDIT 2: I am not asking how to force an activity to show in portrait mode, I am asking if not having the corresponding portrait resource is a potential stability problem.

like image 290
ElYeante Avatar asked Dec 28 '25 20:12

ElYeante


1 Answers

You don't have to put your layouts in layout-land folder if you know y'd be using the landscape mode only. Use the default layout folder and set the orientation to landscape in the manifest file for all your activities.

    android:screenOrientation="landscape"
like image 86
Sayed Jalil Hassan Avatar answered Dec 31 '25 00:12

Sayed Jalil Hassan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!