Changing camera view

First of all, I would like to refer to this Issue on the google groups.

My problem is i want the landscape-native app to work in portrait mode. The way of getting the app into portrait mode is no problem at all, but when you display the app in portrait mode, my problem occurs.

When the Barcode Scanner is starting op, its camera view is (pr. default) at a +90 degree angle. When viewing the app in portrait mode the Barcode Scanner is (naturally) still at a +90 degree angle.

In the referred Issue-page there is displayed a hack to get around the problem, but this does not seem to work on most devices. This does also not work on my targeted devices.

I would like to hear if some of you have got a work around, or found the place in the source where you can 'undo' the 90 degree flipping?

A usable answer will be utmost appriciated :D Unfortunately i can't make progress in the project before this is solved. It is demanded to run in portrait mode ;)

In advance ... Thanks :)


I have implemented this in a private build. It is complicated and I can't share the details. The key steps are:

  • Call Camera.setDisplayOrientation() to counteract the rotation; see the Android javadoc for some discussion on that
  • Make sure that Camera.Parameters.setPreviewSize() is called correctly; preview sizes are reported in landscape but need to be set in portrait
  • (And guess what -- the default orientation of phones is considered portrait but tablets is considered landscape! Make sure you've accounted for that too.)
  • Finally, the preview data is always in landscape mode. You need to rotate it yourself to read it right-side-up, or otherwise account for that.
  • 链接地址: http://www.djcxy.com/p/50694.html

    上一篇: 有Django项目结构/信息流可视化的工具吗?

    下一篇: 更改相机视图