Camera 2 : Unable to record video in full screen?
<p>I'm using google official <a href="https://github.com/googlesamples/android-Camera2Video/blob/master/Application/src/main/java/com/example/android/camera2video/Camera2VideoFragment.java" rel="nofollow noreferrer">sample</a> to work around video recording by using Camera API 2 . but the problem is I'm not able to make it full screen as I limited the screen orientation only to portrait.Here the xml I edited and the <a href="https://github.com/googlesamples/android-Camera2Video/blob/master/Application/src/main/res/layout/fragment_camera2_video.xml" rel="nofollow noreferrer">official xml</a>.  </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;AutoFitTextureView
        android:id="@+id/texture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" /&gt;

    &lt;FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"&gt;

        &lt;Button
            android:id="@+id/video"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/label_record" /&gt;

        &lt;ImageView
            android:id="@+id/info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:contentDescription="Description"
            android:padding="20dp"
            android:src="@drawable/ic_more" /&gt;

    &lt;/FrameLayout&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>I think here is setting the video screen size by aspect ration to the <code>TextureView</code> but I couldn't make it to full screen. Any help is greatly appreciated.</p>

<pre><code>mVideoSize = chooseVideoSize(map.getOutputSizes(MediaRecorder.class));
mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, mVideoSize);
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    mTextureView.setAspectRatio(mPreviewSize.getWidth(), mPreviewSize.getHeight());
} else {
    mTextureView.setAspectRatio(mPreviewSize.getHeight(), mPreviewSize.getWidth());
}
</code></pre>

<p><a href="https://i.stack.imgur.com/ckyue.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ckyue.png" alt="enter image description here"></a></p>