I want to disable changing orientation in my android app, but I want to allow user use his native orientation: landscape for tablets and portrait for phones.
I try to set "android:screenOrientation" with different values, but I can't find appropriate value.
Is such task needs to write java code (and what code I need to write), or this can be solved using manifest?
UPD As in @Pierrew's hint, I need to create res/layout/main.xml
for default layout, res/layout-land/main.xml
for landscape layout and res/layout-port/main.xml
for portrait layout. So, I need to know, how to defined all layout in res/layout/main.xml
and only clarify orientation in res/layout-land/main.xml
and res/layout-port/main.xml
.
I think I need to declare layout in res/layout/main.xml
, and derive all layout properties in res/layout-land/main.xml
and res/layout-port/main.xml
and override only android:screenOrientation
value in derived layout.
How I can do it?