Question

I know I can limit the orientation from the manifest file. Like this

android:screenOrientation="portrait"

But is it possible to set the orientation from code ?

for example setting the activity to full screen can be done both from manifest and from code this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

Était-ce utile?

La solution

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Autres conseils

Activity. setRequestedOrientation(..)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top