如何设置屏幕方向的其他应用程序? [英] How to set screen-orientation for other apps?

查看:143
本文介绍了如何设置屏幕方向的其他应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过以​​下几行,我们可以设置方向与应用程序中。

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

如果我想设置的方向到每一个屏幕(不仅与应用程序)。我该怎么办呢?任何帮助。

在此先感谢

解决方案

  setRequestedOrientation(0);
       要么
 setRequestedOrientation(1);
 

水平(横向) - 0 垂直(potrait) - 1

您可以试试这个。

或者你可以尝试在你的方式。  在这个活动中,你想改变它的方向的onCreate方法,把这个code。在这一点。这将改变布局方​​向。

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

解决方案

 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.

这篇关于如何设置屏幕方向的其他应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆