title: How to set preview size on cameraX preview?
body: <p>I am trying to create a preview in portrait mode and I want the preview to be as wide as the screen and wrap content vertically. However, when I do that I always get the preview size <code>1200x 1200</code> and the preview is stretched horizontally to fill the screen. </p>
  
  <p>The image captured is the correct size though (<code>1024x768</code>.</p>
  
  <p>In other words I want the preview size to be same as image captured. </p>
  
  <p>Any help will be appreciated.</p>
  
  <pre><code>preview = new Preview.Builder()
              .setTargetAspectRatioCustom(new Rational(3, 4))
              .build();
  </code></pre>
  
  <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.molescope.CameraXActivity"&gt;
  
      &lt;androidx.camera.view.PreviewView
          android:id="@+id/preview_view"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintEnd_toEndOf="parent" /&gt;
  
      &lt;ImageButton
          android:id="@+id/capture_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          android:layout_marginBottom="@dimen/margin_vertical"/&gt;
  
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <pre><code>    def camerax_version = "1.0.0-beta03"
      implementation "androidx.camera:camera-core:${camerax_version}"
      implementation "androidx.camera:camera-camera2:${camerax_version}"
      implementation "androidx.camera:camera-lifecycle:${camerax_version}"
      implementation "androidx.camera:camera-view:1.0.0-alpha10"
      implementation "androidx.camera:camera-extensions:1.0.0-alpha10"
  </code></pre>