image preview is stretched in 18:9 aspect ratio devices
On running the Camera2Basic in 18:9 screen aspect ratio devices, the image preview and captured image is getting stretched.

I am requesting the mPreviewSize of 1440 X 1080 while the device's available resolution is 1912 X 1080.
Tried several suggestions available but none worked.
Check the width and height in your xml texture view.
This is mine, had "match_parent" before and in my Constraint Layout, it is constrained to the top only, not the bottom,
<com.guanacodevs.cardreader.AutoFitTextureView
android:id="@+id/texture_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#000"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
GuanacoDevs Very nice!!
Did you find a solution?
I have fullscreen app with landscape orientation, no action bar, no status bar TextureView matches parent (width and height), but still 1440x1080...
It's not about view, map.getOutputSizes(SurfaceTexture.class); returns 1440x1080 as maximum
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jack.mainactivity.MainActivity">
<TextureView
android:id="@+id/texture"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
more about issue:
https://stackoverflow.com/questions/52374888/camera2-1440x1080-is-maximum
https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java#L740
@GuanacoDevs please take a look at my issue
Hy, I've got the same problem than you. I think is the ConstraintLayout that change the ratio off the textureview, if you try a linearLayout, the probleme is gone... If you solve it with the ConstraintLayout, please let me know...
This sample has been migrated to a new location where we can accept Pull Requests (check README for more information).
As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.
If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!