title: How to zoom the preview using Android CameraX library?
body: <p>I hope to add a function to zoom in preview picture (Please see <em>Image A</em>) for the sample code at <a href="https://github.com/android/camera/tree/master/CameraXBasic" rel="nofollow noreferrer">https://github.com/android/camera/tree/master/CameraXBasic</a></p>
  
  <p>I have read the <a href="https://stackoverflow.com/questions/56057310/how-to-zoom-camera-using-android-camerax-api">article</a> but the following code doesn't work. How can I zoom the preview with CameraX API 1.0.0-alpha05 ?</p>
  
  <p><strong><a href="https://github.com/android/camera/blob/master/CameraXBasic/app/src/main/java/com/android/example/cameraxbasic/fragments/CameraFragment.kt" rel="nofollow noreferrer">CameraFragment.kt</a></strong> </p>
  
  <pre><code> /** Declare and bind preview, capture and analysis use cases */
      private fun bindCameraUseCases() {
  
         ...
  
          // Apply declared configs to CameraX using the same lifecycle owner
          CameraX.bindToLifecycle(
                  viewLifecycleOwner, preview, imageCapture, imageAnalyzer)
  
         //I added code
          var my=Rect(0,0,500,500)
          preview.zoom(my)
      }
  </code></pre>
  
  <p><strong>Image A</strong></p>
  
  <p><a href="https://i.stack.imgur.com/cndRb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cndRb.png" alt="enter image description here"></a></p>