'Xamarin android Camera2 - image preview getting stretched on 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.
Device camera and camera2 basic side by side:

How would i resolve this while keeping the preview ratio as 1.33? I tried setting the height of the texture preview by keeping the ratio 1.33 as constant and scaling the height with width as 1080.
var ratio = 1.33;
var scaledWidth = mPreviewSize.Height;
var scaledHeight = (int)Java.Lang.Math.Round(scaledWidth * ratio);
mTextureView.SetAspectRatio(scaledWidth, scaledHeight);
But result is still the same.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
