我正在使用Samsung Galaxy Note运行phonegap应用程序。当我拍照时,我可以看到屏幕在进入相机之前旋转。如何禁用此功能?
我已经尝试在主线和相机活动上强制使用肖像方向,但这些似乎都不起作用:
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".App" android:windowSoftInputMode="adjustPan" android:screenOrientation="portrait"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
</intent-filter>
</activity>
<activity android:name="com.android.camera.Camera"
android:screenOrientation="portrait">
</activity>
</application>
发布于 2011-12-27 16:58:00
您需要在清单上添加权限:
<uses-feature android:name="android.hardware.screen.portrait" />
Doc android of balise uses-feature
例如,如果您的应用程序需要纵向,则应声明<uses-feature android:name="android.hardware.screen.portrait"/>
,以便只有支持纵向的设备(无论是始终还是用户选择)才能安装您的应用程序。如果您的应用程序同时支持这两种方向,则不需要声明任何一种。
发布于 2011-11-23 21:57:48
你是怎么拍照的?如果您发送意图来启动相机应用程序,您将失去对方向更改的控制。还要注意的是,在进入睡眠和锁屏之前,无论设置或覆盖方法如何,launcher都会强制您的应用程序进入纵向。很可能你不能,在其他设备上的行为可能会有所不同。
发布于 2011-11-23 21:14:13
在要将屏幕设置为纵向的地方使用android:configChanges="orientation|keyboardHidden"
。
https://stackoverflow.com/questions/8242749
复制相似问题