How to set screen-orientation for other apps?

巧了我就是萌 提交于 2019-12-21 19:58:09

问题


With the following lines we can set the orientation with in the application..

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

If I want to set the orientation to every screen(not only with in application). how can i do this? Any help.

Thanks in advance


回答1:


 setRequestedOrientation(0);
       or
 setRequestedOrientation(1);

horizontal (landscape) - 0 vertical (potrait) - 1

You can try this.

Or you can try it in your way. In the onCreate method of that activity, which orientation you like to change,put this code in that. It will change that layout orientation.



来源:https://stackoverflow.com/questions/4820392/how-to-set-screen-orientation-for-other-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!