android禁止所有activity横屏

https://q.cnblogs.com/q/29070/

 

1,让你的所有Activity都继承一个BaseActivity,然后在BaseActivity的onCreate()方法中加上

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

 

2,Manifest.xml文件中为所有Activity加上配置属性 android:screenOrientation=”portrait”

Leave a Reply

Your email address will not be published. Required fields are marked *