Camera zoom not working

前端 未结 5 1380
盖世英雄少女心
盖世英雄少女心 2020-12-15 14:39

I am using the API 2.1 and my debug shows a max zoom value of 15. The code here does not make the camera zoom. How do I get the camera to zoom?

camera = Came         


        
5条回答
  •  有刺的猬
    2020-12-15 15:15

    Your samples about zooming is work, thanks a lot.

    This is my code :

    zooming = (ZoomControls) findViewById(R.id.zooming);
    zooming.setOnZoomInClickListener(new OnClickListener() {
        public void onClick(View v) {
            Camera.Parameters p = mCamera.getParameters();
            int maxZoom = p.getMaxZoom();
    
            if (p.isZoomSupported()) {
               zoom += 10;
               if (zoom > maxZoom) {
                   zoom -= 10;
               }
               p.setZoom(zoom);
            }
    
            mCamera.setParameters(p);
    
            try {
                mCamera.setPreviewDisplay(mSurfaceHolder);
            } catch (Exception e) { }
    
             mCamera.startPreview();
        }
    });
    

    I hope your application is working too.

提交回复
热议问题