如何全局锁定 Android 设备屏幕方向
我想将 Android 设备上的所有应用程序的屏幕锁定为横向或爱国者模式。 除了禁用自动屏幕方向之外,我还应该做什么?
我已经从 Android 市场查看了一些应用程序,并尝试看看它们的作用。 似乎这些应用程序创建了一个服务来像这样操作 WindowManager。
WindowManager wm = (WindowManager)getSystemService(CONTEXT.WINDOW_SERVICE);
CustomLayout cl = new CustomLayout(desire_orientation);
View localView = new View(this);
wm.addView(localView, cl);
但是当我无法做这样的事情时。有什么想法吗?
另外,我可以更改框架代码,从 Java 更改为 C++,还有其他方法吗?
I want to lock screen to landscape or patriot mode for all apps on my Android device.
What should I do beside disable auto screen orientation?
I have check out some apps from android market and try to see what they do.
It seems those apps create an service to manipulate WindowManager like this.
WindowManager wm = (WindowManager)getSystemService(CONTEXT.WINDOW_SERVICE);
CustomLayout cl = new CustomLayout(desire_orientation);
View localView = new View(this);
wm.addView(localView, cl);
But when I fail to do something like this. Any idea?
Also, I am able to change framework code, from Java to C++, any other way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我有用。
this works for me.