【发布时间】:2018-12-16 19:00:06
【问题描述】:
(相关)我发现 here、here 和 here 是描述 ZXingBarcodeImageView 在 Xamarin Forms 中呈现模糊 QR 码的相关问题的问题 - 但它们没有导致解决我的问题。
问题
我正在使用ZXing 在 Xamarin 表单中绘制和显示 QR 码,但它生成的 QR 码是模糊的。
原因是在.xaml页面我设置了ZXingBarcodeImageView属性WidthRequest=300和HeightRequest=300。这是ZXing库绘制后的二维码拉伸:
<forms:ZXingBarcodeImageView
IsVisible="True"
x:Name="QRCodeView"
BarcodeFormat="QR_CODE"
HeightRequest="300" //Stretching Height
WidthRequest="300" //Stretching Width
BarcodeValue="-1"
/>
This 问题的最佳答案建议提前绑定属性Height 和Width,但无论我如何更改它建议的BarcodeOptions 数组中的参数,QR 码都保持不变。
如何在绘图前更改ZXingBarcodeImageView的设置尺寸以避免拉伸?
【问题讨论】:
标签: xamarin xamarin.forms zxing zxing.net