1

params.isZoomSupported() 在三星 Galaxy SIII 的自定义相机中返回 false,但是当我访问默认相机时它支持缩放,并且相同的代码在三星平板电脑中运行良好。有谁知道为什么会这样。这是我的代码

公共无效setZoomControl(最终Camera.Parameters params){

    System.out.println("setZoomControl called");
    if (params.isZoomSupported()) {
        final int maxZoomLevel = params.getMaxZoom();
        Log.i("max ZOOM ", "is " + maxZoomLevel);
        zoomControls.setIsZoomInEnabled(true);
        zoomControls.setIsZoomOutEnabled(true);

        zoomControls.setOnZoomInClickListener(new OnClickListener(){


            public void onClick(View v){
                if(currentZoomLevel < maxZoomLevel){
                    currentZoomLevel++;
                    //mCamera.startSmoothZoom(currentZoomLevel);
                    params.setZoom(currentZoomLevel);
                    mCamera.setParameters(params);
                }
            }
        });

        zoomControls.setOnZoomOutClickListener(new OnClickListener(){
            public void onClick(View v){
                if(currentZoomLevel > 0){
                    currentZoomLevel--;
                    params.setZoom(currentZoomLevel);
                    mCamera.setParameters(params);
                }
            }
        });    
    }
    else
    {
        zoomControls.setVisibility(View.GONE);
         System.out.println("setZoomControl called not supported");
    }

}
4

0 回答 0