params.isZoomSupported()在三星galaxy SIII mini中返回false

时间:2013-10-24 10:13:33

标签: android

params.isZoomSupported()在三星galaxy SIII的自定义相机中返回false但是当我访问默认相机时它支持缩放,并且相同的代码在Samsung Tablet中工作正常。  有谁知道为什么会这样。  这是我的代码

public void setZoomControl(final 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");
    }

}

0 个答案:

没有答案