通常我经常使用我的手机躺在床上(用手机相机面向天花板),方向变化让我发疯。从字面上看,如果我转过手机几度,它将从Portait到横向横向,反之亦然。
我可以禁用自动旋转,但在某些情况下是不可取的,就像我打开肩膀时,我希望方向改变。
基本上,是否可以为屏幕旋转写自己的逻辑,并使它在系统范围内运行?
upd:我不想切换自动旋转。我想重写基于当前传感器设置的逻辑改变系统级别的屏幕方向。
通常我经常使用我的手机躺在床上(用手机相机面向天花板),方向变化让我发疯。从字面上看,如果我转过手机几度,它将从Portait到横向横向,反之亦然。
我可以禁用自动旋转,但在某些情况下是不可取的,就像我打开肩膀时,我希望方向改变。
基本上,是否可以为屏幕旋转写自己的逻辑,并使它在系统范围内运行?
upd:我不想切换自动旋转。我想重写基于当前传感器设置的逻辑改变系统级别的屏幕方向。
Very often I use my phone lying in bed (with phone camera facing the ceiling) and the orientation changes drive me crazy. Literally if I turn the phone a few degrees it will go from portait to landscape and vice versa.
I can disable auto-rotation, but it's not desirable in some scenarios, like when i turn on my shoulder and I want the orientation to change.
Basically, is it possible to write your own logic for screen rotation and make it run on system wide scope?
UPD: I do not want to toggle auto-rotation. I want to rewrite that logic that based on current sensor setting changes the screen orientation on system level.
这个 widget 效果嘛......没有需要客户ROM或root。 :0)
This widget works well... No customer rom or root required. :0)
您可以在满足您想要的任何条件时编写一个应用程序,锁定到纵向方向。
所以你可以让它永远是肖像,除非手机在横向位置保持完全垂直。
据我所知,你不能强迫横向方向,所以你必须只能启用自动运动,除非你想要自己的rom。您的应用可能需要是一个 service 并使用<一个href ="http://developer.android.com/reference/android/hardware/sensormanager.html" rel ="nofollow" > sensormanager 。
您可以搜索android源在google code 。
You could write an app that locks to portrait orientation when whatever conditions you want are met.
So you could make it always be portrait unless the phone is held perfectly vertical in landscape position.
As far as I can tell, you can't force landscape orientation, so you'll have to just enable autorotation unless you want to make your own ROM.
Your app will probably need to be a Service and use SensorManager.
You can search the Android source on Google Code.
在Cyanogenmod中,您可以在通知栏上设置电源小部件,氰中的电源小部件增强,因此可以控制更多的设置,其中一个是锁定传感器的能力。无论何时要锁定,只需拔出通知栏并点击锁定方向按钮。
In CyanogenMod, and you can set up to have the power widget on the notification bar, the power widget in Cyanogen is enhanced so it can control more settings, one of it is the ability to lock the orientation sensor. Whenever you want to lock, simply pull out the notification bar and tap on the lock orientation button.
© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有