把重點我想實現觸摸對焦功能,在我的自定義相機。 這是谷歌https://github.com/googlesamples/android-Camera2Basic實施輕按Camera2 API
提供的基本代碼下面的代碼片段在那裏我覺得我應該加入我的特點 如果有人已經實現了Camera2 API,請幫助!
private void lockFocus() {
try {
// This is how to tell the camera to lock focus.
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
CameraMetadata.CONTROL_AF_TRIGGER_START);
// Tell #mCaptureCallback to wait for the lock.
mState = STATE_WAITING_LOCK;
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
您能否提供樣片代碼? –
示例代碼將是一個很大的幫助。 –