方式一:
在AndroidMainfest.XML中的activity属性设定中
加入android:screenOrientation=”portrait”,屏幕设定为竖屏
加入android:screenOrientation=”landscape”,屏幕设定为横屏
方式二:
在onCreate方法中,super.onCreate(savedInstanceState);后
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);设定为竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);设定为横屏
版权声明:本文为baidu_37196178原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。