What's the correct way to implement Tap To Focus for camera?

前端 未结 5 1565
难免孤独
难免孤独 2021-01-30 10:59

I\'m working on an app which has a custom camera screen, for which I\'m supposed to implement tap to focus, like in the Android(more specifically, the Galaxy S4) camera app.

5条回答
  •  庸人自扰
    2021-01-30 11:32

    I have the same issue. I've checked this on many devices, and many Android versions.

    It appears that focus-area is not working in CONTINUOUS focus-mode.

    My workaround is to set focus-mode to AUTO or MACRO along with setting focus-area:

    params.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO);
    params.setFocusAreas(focusAreas);
    mCamera.setParameters(params);
    

    Please note that the stock Camera app on Galaxy S3 & S4 works the same way: it's permanently in continuous mode. When you touch the screen it switches to auto & sets focus-area. But after a while it comes back to continuous mode, and focus-area goes back to the center of the screen.

    I hope this helps you somehow.

提交回复
热议问题