If you used the Android API demos, you need to change the OnLayout()
function.
Basically, the demo version of the Android API sets the preview size according to the aspect ratio, so that the preview image is compressed and displayed in the center of the screen with a small size in portrait mode.
Even if we adjust the screen orientation in portrait mode, the width and height of the preview will not be changed. This is why the preview image was compressed.
source share