问题描述
我想锁定我的摄像机视图以风景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的横向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!