Droid X相机自动对焦回调始终返回false [英] Droid X camera autofocus callback always returns false

查看:118
本文介绍了Droid X相机自动对焦回调始终返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Motorola Droid X,由于某种原因,onAutoFocus(布尔型成功,Camera camera)中成功的成功变量总是返回false.它似乎可以与包括Droid 2在内的其他设备一起使用,因此这似乎是特定于设备的问题.

I'm using the Motorola Droid X and for some reason the success variable for success in the onAutoFocus(boolean success, Camera camera) always returns false. It seems to work with other devices including a Droid 2 so it's seems to be a device specific problem.

我的代码基本上是这样的:

My code is basically this:

camera.autoFocus(new AutoFocusCallback() {
    @Override
    public void onAutoFocus(boolean success, Camera camera) {
        takePicture();
    }
});

推荐答案

经过数小时的调试,问题在于将曲面视图的预览尺寸设置为较大的尺寸.我不明白为什么这会影响自动对焦,但是将预览尺寸设置为较小的尺寸可以解决此问题.可能是因为预览尺寸大于屏幕分辨率,因为这是唯一不起作用的分辨率.希望这对可能遇到此问题的其他人有所帮助.

After hours of debugging, the problem was setting the preview size of the surface view to a large size. I don't understand why that would affect the autofocus but setting the preview size to a smaller size fixed the problem. It might be caused by the preview size being larger than the screen resolution because that was the only resolution that didn't work. Hope this helps anyone else who might run into this problem.

更新: 更改预览页面的布局后,我再次遇到此问题,并且似乎对于某些预览尺寸而言,焦点只是失败了.到目前为止,这些尺寸对我来说失败了:720x480、1280x720

Update: I ran into this problem again after changing the layout of my preview page and it seems like the focus just fails for certain preview sizes. So far these sizes failed for me: 720x480, 1280x720

这篇关于Droid X相机自动对焦回调始终返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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