3

我正在尝试制作一个自定义相机应用程序,让用户触摸屏幕进行对焦而不是拍照。Android中是否有任何相关的API支持?

public void takePhoto(File photoFile, String workerName, int width, int height,   int        quality) {
if (getAutoFocusStatus()){
    camera.autoFocus(new AutoFocusCallback() {
        @Override
        public void onAutoFocus(boolean success, Camera camera) {
            camera.takePicture(shutterCallback, rawCallback, jpegCallback);
        }
    }); 
}else{
    camera.takePicture(shutterCallback, rawCallback, jpegCallback);
}

this.photoFile = photoFile;
this.workerName = workerName;
this.imageOutputWidth = width;
this.imageOutputHeight = height;
}

public void takePhoto(File photoFile, int width, int height, int quality) {
takePhoto(photoFile, null, width, height, quality);
}
4

1 回答 1

2

如果您不想拍照,请不要从自动对焦回调中调用 takepicture()。此外,如果您想关注用户触摸屏幕的点,您可以使用 setFocusAreas() 来设置焦点区域。

于 2013-05-22T06:19:03.713 回答