android - Set orientation fixed for all activities -


i know there 2 ways set activity's orientation landscape, either programmatically

setrequestedorientation(activityinfo.screen_orientation_landscape); 

or in manifest:

android:orientation="landscape" 

currently, use first 1 in superclass, because have many (child) activities want in landscape. however, make oncreate being called twice, leads other issues. when using manifest-route, have apply activities separately, undoubtedly lead 1 being missed out in future (not mention code copying).

is there way apply android:orientation="landscape" activities in app?

in manifest, set activities:

<activity android:name=".youractivity" android:configchanges="orientation" android:screenorientation="portrait"/> 

let me explain:

with android:configchanges="orientation" tell android responsible of changes of orientation. android:screenorientation="portrait" set default orientation mode.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -