android上的相机预览-sdk 1.5版本上的奇怪行 [英] camera preview on android - strange lines on 1.5 version of sdk

查看:50
本文介绍了android上的相机预览-sdk 1.5版本上的奇怪行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Android应用程序开发相机模块.在主应用程序中,当用户单击拍照"按钮时,将打开带有SurfaceView控件的新视图并显示相机预览.当用户单击dpad center时,相机将拍摄照片并将其保存到光盘中.非常简单明了.

I am developing the camera module for an android application. In main application when user clicks on 'take picture' button, new view with SurfaceView control is opened and camera preview is shown. When users click on dpad center, camera takes picture and save it to the disc. Pretty simple and straightforward.

一切都可以在我的设备上正常运行-HTC Tattoo,minsdkversion 1.6

Everything works fine on my device - HTC Tattoo, minsdkversion 1.6

...但是当我在HTC Hero minsdkversion 1.5上测试应用程序时,显示摄像机预览时,会出现一些奇怪的行.

...but when I tested application on HTC Hero minsdkversion 1.5, when camera preview is shown,some strange lines occur.

任何人都知道发生了什么事

Anyone has idea what is going on?

p.s.预览已完全崩溃,拍照效果很好

p.s. altough preview is crashed, taking of pictures works fine

这是图片替代文字http://img163.imageshack.us/img163/4088/camerademo.jpg :

感谢马可

推荐答案

显然,这是Hero bug,在功能surfaceChanged中,开关的宽度和高度参数为

Apparently this is hero bug, in function surfaceChanged switch width and height parameters:

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) 
    { 
        parameters.setPreviewSize(h, w); //instead of w,h
    }

这篇关于android上的相机预览-sdk 1.5版本上的奇怪行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆