his is the way we can fix the activity orientations.
android:screenOrientation="landscape">
we can give this in manifest.xml or through code in oncreate method.
In manifest.xml just add this to the activity attribute tag for portrait add this
android:screenOrientation="portrait">
for landscape add this
This can be set using code also if you add this line in oncreate() method the activity will set to the screenorientation.
for activity orientation in Landscape add this
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
similar for portrait
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
But you must add these line in OnCreate() and before setContentView().
No comments:
Post a Comment