如何设置安卓screenOrientation ="人像"相机 [英] How to set android:screenOrientation="portrait" for Camera
问题描述
我使用的三星Galaxy Note运行PhoneGap的应用程序。 当我拍照,我可以看到,屏幕上就在进入相机的旋转。 如何禁用呢?
我试图强迫纵向两个,主线程和放大器;摄像头的活动, 但这些似乎并没有工作:
<应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME
机器人:可调试=真正的>
<活动机器人:应用程序名称=机器人:windowSoftInputMode =adjustPan机器人:screenOrientation =画像
机器人:标签=@字符串/ APP_NAME机器人:configChanges =方向| keyboardHidden>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
<活动机器人:名称=com.phonegap.DroidGap机器人:标签=@字符串/ APP_NAME
机器人:configChanges =方向| keyboardHidden>
<意向滤光器>
&所述; /意图滤光器>
< /活性GT;
<活动机器人:名称=com.android.camera.Camera
机器人:screenOrientation =画像>
< /活性GT;
< /用途>
您需要添加权限清单:
<使用特征的android:NAME =android.hardware.screen.portrait/>
例如,如果您的应用程序需要纵向,应声明<使用特征的android:NAME =android.hardware.screen.portrait/>
所以只有支持纵向(是否总是或按用户选择)的设备可以安装的应用程序。如果您的应用程序支持两个方向,那么你就需要申报无论是。
I am using Samsung Galaxy Note to run a phonegap application. When I take picture, I can see that screen rotates just before entering camera. How can I disable this?
I have tried to force portrait orientation on both, the main thread & camera activity, but those do not seem to work:
<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>
You need to add the permission on the manifest:
<uses-feature android:name="android.hardware.screen.portrait" />
Doc android of balise uses-feature
For example, if your app requires portrait orientation, you should declare <uses-feature android:name="android.hardware.screen.portrait"/>
so that only devices that support portrait orientation (whether always or by user choice) can install your app. If your application supports both orientations, then you don't need to declare either.
这篇关于如何设置安卓screenOrientation =&QUOT;人像&QUOT;相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!