Fix aspect ratio issues with preview#281
Fix aspect ratio issues with preview#281owahltinez merged 1 commit intoandroid:masterfrom lnishan:master
Conversation
It seems that ConstraintLayout resizes children so that they don't clip. This creates problems for AutoFitSurfaceView. AutoFitSurfaceView attempts to set the measured dimension to be "just bigger" than the viewfinder and expect that the overflowing pixels would be clipped, creating the desired "center-crop" effect. This commit changes the parent layout to FrameLayout. TEST=Deployed on Pixel 4 AVD and verify the aspect ratios look right in the test scene.
|
This should fix #256 I think |
|
Thank you Jasmine, very interesting finding! Did you file a bug internally, or do you think ConstraintLayout's behavior is WAI? |
|
Hi Oscar, I didn't file a bug internally. I was hoping to find some references that might answer my question but didn't find anything conclusive.
The AutoFitSurfaceView is set to "match_parent", which seems to be disallowed according to that line. So it's at the very least, undefined behavior. |
It seems that ConstraintLayout resizes children so that they don't clip.
This creates problems for AutoFitSurfaceView. AutoFitSurfaceView
attempts to set the measured dimension to be "just bigger" than the
viewfinder and expect that the overflowing pixels would be clipped,
creating the desired "center-crop" effect.
This commit changes the parent layout to FrameLayout.
TEST=Deployed on Pixel 4 AVD and verify the aspect ratios look right in
the test scene.