android camera移动方向_Android Camera开发系列:调整Camera预览方向

有时候我们想根据自己的需要调整下Camera的预览方向,那么是调用哪个API可以达到我们的目的呢?

我们看下下图拍的几张小可爱的照片,分别是正常方向、旋转180度、90度拍的照片。

7a9652639b88d2a37b906435c6663923.png

ec8c88dd3a5abd7c129e7bb49e81798a.png

83684d3c623d56ca3fd991c7e3e52dfa.png

一、Camera API

Camera1上,我们可以通过setDisplayOrientation(int degress);来设置camera预览的方向。

mCamera.setDisplayOrientation(Surface.ROTATION_180);

这里也贴下源码里面关于setDisplayOrientaion接口的详细说明。

/**

* Set the clockwise rotation of preview display in degrees. This affects

* the preview frames and the picture displayed after snapshot. This method

* is useful for portrait mode applications. Note that preview display of

* front-facing cameras is flipped horizontally before the rotation, that

* is, the image is reflected along the central vertical axis of the camera

* sensor. So the users can see themselves as lo

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值