Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个使用手机摄像头的 Android 应用程序。当以“标准方向”(手机底部在手机底部或手机底部向右)拍摄照片时,接收到的图像与预期的一样。在某些手机上,当以“非标准方向”(手机底部在手机顶部或手机底部向左)拍摄照片时,接收到的图像是上下颠倒的。在某些手机上,相机应用程序实际上会处理此问题并以预期的方式返回图像。
我的问题是,由于它似乎取决于手机(制造商),有没有办法检测到这一点并根据需要旋转图像,而不必保留手机类型的硬编码列表?
您需要在相机设备上设置旋转以获得正确旋转的图像。尝试使用 -
public void setRotation (int rotation)
检查此处提供的示例代码