Open viniciusverasdossantos opened 3 years ago
Yes please, this does not seem to be responding to HeightRequested.
Yes HeightRequest isn't working properly. It does not properly scale to layouts either. Would love a fix for this
Seems to be a chronic bug, and i saw a proposed fix in a different ticket. Please give this some attention.
Is this happening only on Android for you guys? I am probably facing the same issue, however the sizing works fine on iOS for me.
There seems to be an issue with the PreviewView.
I easily managed to reproduce this issue with the sample project "BigIslandBarcode" by simply putting the CameraBarcodeReaderView
into the first grid row (as opposed as letting it spana cross the total view)
<Grid RowDefinitions="1*,3*,1*">
<zxing:CameraBarcodeReaderView
- Grid.Row="0" Grid.RowSpan="3"
+ Grid.Row="1"
x:Name="barcodeView"
BarcodesDetected="BarcodesDetected"
/>
When the CameraManager.android.cs creates the native view (PreviewView)
its ScaleType
is set to FillCenter
https://developer.android.com/media/camera/camerax/preview?hl=en#scale-type
This should be fine, since it should just fill the available space of the PreviewView
with the image data.
However, it does not:
Now, a simple change of mine was to
CameraManager.android.cs CreateNativeView
and changed the ScaleType
to FitCenter
.
Now the height is respected, but the image does not stretch to the maximum available width anymore:
So: Is this an AndroidX bug, or MAUI related?
I get it to work with the following handler override
protected override PreviewView CreatePlatformView()
{
var result = base.CreatePlatformView();
result.SetScaleType(PreviewView.ScaleType.FillCenter);
result.SetClipChildren(true);
result.SetClipToPadding(true);
result.ClipToOutline = true;
return result;
}
I have been able to work around this by wrapping the CameraBarcodeReaderView inside a (transparent) Frame.
I need to have a ListView and the barcode reader below it so that upon detecting it will add the product to the list. I was unable to resize CameraBarcodeReaderView. Is there a possibility?