【发布时间】:2015-09-06 19:46:03
【问题描述】:
我知道我可以在manifest中设置activity的方向,但是当这个activity调用MediaStore.ACTION_IMAGE_CAPTURE打开相机拍照时,用户仍然可以在横向模式下拍照。我可以将相机应用程序本身的方向锁定为纵向吗?
这是一个示例代码:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
startActivityForResult(intent, TAKE_PICTURE);
我想阻止用户拍摄任何风景照片。
任何帮助将不胜感激。
编辑:发现关于该主题的另一个尚未回答的问题: How to lock the camera app orientation called through intent in android?
【问题讨论】:
-
你试过setDisplayOrientation方法吗????
-
@KeyurLakhani 我不确定是否可以将它与
MediaStore.ACTION_IMAGE_CAPTURE方法一起使用。 -
尝试使用intent i.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-
@KeyurLakhani 谢谢,我试过了,但没有任何效果。作为记录,设备上的屏幕方向也锁定为纵向,但相机应用仍然可以横向拍照。
-
对不起!!运气不好,但最后这可能有用stackoverflow.com/questions/6813166/…
标签: android android-camera-intent