Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓相机触摸焦点_Android_Camera_Focus - Fatal编程技术网

Android 安卓相机触摸焦点

Android 安卓相机触摸焦点,android,camera,focus,Android,Camera,Focus,我正在尝试制作一个自定义相机应用程序,我想让用户可以在此应用程序中选择聚焦模式 默认情况下,聚焦模式为自动聚焦 如果我想将cameraView设置为可单击,这样当我在屏幕上触摸一个点时,相机的焦点就在该点上?怎么开始呢? 下面是我的代码 public void takePhoto(File photoFile, String workerName, int width, int height, int quality) { if (getAutoFocusStatus()){

我正在尝试制作一个自定义相机应用程序,我想让用户可以在此应用程序中选择聚焦模式

默认情况下,聚焦模式为自动聚焦

如果我想将cameraView设置为可单击,这样当我在屏幕上触摸一个点时,相机的焦点就在该点上?怎么开始呢? 下面是我的代码

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);
}

当你触摸屏幕上的某个点时,你应该会得到一个提示。焦点区域仅在当前焦点模式为焦点模式自动、焦点模式宏、焦点模式连续视频或焦点模式连续图片时有效。然后您应该调用该方法来trgigger focus。相机的视野从左上角(-1000,-1000)映射到右下角(10001000)。所以你必须进行坐标转换