English 中文(简体)
如何安装和刺 to:摄像机的屏幕定向=“portrait”
原标题:How to set android:screenOrientation="portrait" for Camera

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>
最佳回答
问题回答

你们如何了解情况? 如果你打算发射照相机,你就会失去对方向变化的控制。 并且指出,在睡觉和锁定屏幕发射器之前,你会把其应用到带有星号的环境或压倒性方法的漏洞中。 很可能你无法做到,在其他装置上的行为可能有所不同。

使用<条码>android:configChanges=“orientation key板Hidden”,在座标有孔隙。

这里需要考虑两点。 第一,

android:screenOrientation="landscape"

如果在java法典中存在类似情况,则无效果:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

那么,还有这种其他方法可以供大家使用:

mCamera.setDisplayOrientation(90);

这将轮换你的摄像机。

希望这一帮助!





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签