Android Camera preview zoom using double finger touch

后端 未结 3 1980
醉梦人生
醉梦人生 2021-02-06 08:29

I am trying to do zoom using double finger touch gesture in the camera preview mode. But i unable to do that. I have done that Zoom control on the ImageView and it\'s working fi

3条回答
  •  青春惊慌失措
    2021-02-06 08:44

    I got the solution of my problem, Following is the solution.

     case MotionEvent.ACTION_MOVE:
    
    
                  if (mode == ZOOM) {
                    float newDist = spacing(event);
    
                    double zoomDist = newDist-oldDist;
    
                    if(zoomDist > 0){
                        if(zoomDist > 50 && zoomDist <= 200){
    
                            if (curZoomLevel < mZoomMax && gestureZoom == 0) {
                                gestureZoom ++;
                                GestureZoomIn();
                            }
    
                        }else if(zoomDist > 200 && zoomDist <= 300){
    
    
                            if (curZoomLevel < mZoomMax && gestureZoom == 1) {
    
                                gestureZoom ++;
                                GestureZoomIn();
                            }
                        }else if(zoomDist > 300 && zoomDist <= 400){
    
                            if (curZoomLevel < mZoomMax && gestureZoom == 2) {
    
                                gestureZoom++;
                                GestureZoomIn();
                            }
    

    //

     private void GestureZoomIn(){
           if (mParameters.isZoomSupported()){
                mZoomMax = mParameters.getMaxZoom();
                if (zoom_text_value

    //

    private void GestureZoomOut(){
           if (mParameters.isZoomSupported()){
    
                if (0

    The above code i used to implement the multi zoom in camera review.

提交回复
热议问题