Han*_*nry 5 android android-camera-intent
我想强制默认的 android 相机仅在横向模式下拍照。我试过以下:
Intent cameraIntent=new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "Pic.jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
cameraIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
startActivity(cameraIntent);
Run Code Online (Sandbox Code Playgroud)
但这仅适用于 2.1,不适用于以后。我只想在横向模式下保存照片图像。我不想使用任何图像处理,例如矩阵或自定义相机。
注意:我从方向固定为“纵向”的活动中调用此意图
在 androidmanifest.xml 中
<activity android:name="activity_name" android:screenOrientation="landscape" />
Run Code Online (Sandbox Code Playgroud)
此活动将是您的图像捕获活动。