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

前端 未结 5 1490
难免孤独
难免孤独 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:53

     binding.cPreview.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCamera.autoFocus(myAutoFocusCallback);
            }
        });
    
    
     Camera.AutoFocusCallback myAutoFocusCallback = new Camera.AutoFocusCallback(){
    
            @Override
            public void onAutoFocus(boolean arg0, Camera arg1) {
                // TODO Auto-generated method stub
            }};
    

提交回复
热议问题