I have implemented a Camera X preview which handle both portrait an landscape orientation. Basics google params are good for portrait mode, but when I'm rotating my device the preview in landscape mode is broken the same as this question (see pic)
Preview preview = new Preview.Builder()
//.setTargetResolution(size)
//.setTargetAspectRatio(AspectRatio.RATIO_16_9)
.setTargetRotation(Surface.ROTATION_90)
.build();
I've tried all setter I found on SO and google camera doc like setTargetRotation
and setTargetAspectRatio
above, and also tried with matrix but nothing change in landscape.
How can I get more or less the same full screen preview in both orientation ?