锁定你的相机,以便在Android的横向模式 [英] lock your camera view to landscape mode in android

查看:561
本文介绍了锁定你的相机,以便在Android的横向模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想锁定我的摄像机视图风景mode.When我点击我的应用程序的简单的按钮,那个时候设备的摄像头将打开,并摄像头应该被锁定风景模式。任何人都可以知道这个问题的解决办法吗?

I want to lock my camera view to "Landscape" mode.When I click on the simple button in my app, that time device's camera will open and and that camera should be locked to "Landscape mode". Can anyone know the solution of this problem?

我使用里面的CaptureImageActivity.java活动这个code。 因此,执行本次活动后,我的系统的摄像头将打开。

I am using this code inside "CaptureImageActivity.java" activity. So after execution of this activity my system's camera will open.

btn1.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent i=new Intent(android.provider.MediaStore. ACTION_IMAGE_CAPTURE);
            i.putExtra(android.provider.MediaStore.EXTRA_SCREEN_ORIENTATION,ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


            startActivityForResult(i,1000);

        }
    });

和我想要锁定的摄像头,以风景模式。而根据解决方案

And I want to lock that camera view to "LandScape Mode". And as per solution

<activity android:name=".CaptureImageActivity"
    android:screenOrientation="landscape"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

只有CaptureImageActivity活动锁定为风景模式。

Only "CaptureImageActivity" activity is locked to "LandScape Mode".

推荐答案

将此到您的内部清单文件活性

Add this into your activity inside manifest file

android:screenOrientation="portrait"

这篇关于锁定你的相机,以便在Android的横向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆