gpt4 book ai didi

android - 如何正确设置 ZXingScannerView 的选项?

转载 作者:行者123 更新时间:2023-12-05 06:06:22 56 4
gpt4 key购买 nike

我在 Xamarin Forms 项目中使用 Zxing.Net.Mobile。

我在页面上调用了 ZXingScannerView,但扫描仪选项似乎不起作用。我设置了特定类型的条形码进行扫描,但它仍会扫描焦点中的所有内容。

我在 page.xaml 调用 scannerview:

 <zxing:ZXingScannerView x:Name="scanView"
Grid.Row="0"
Options="{Binding opts}"
IsScanning="True"
WidthRequest="300"
HeightRequest="600"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>

然后在 xaml.cs 中定义选项

public static readonly ZXing.Mobile.MobileBarcodeScanningOptions opts = new ZXing.Mobile.MobileBarcodeScanningOptions
{
PossibleFormats = new List<ZXing.BarcodeFormat> { ZXing.BarcodeFormat.AZTEC },
TryHarder=true
};

我做错了什么?

最佳答案

感谢@Jason。答案是像这样在页面构造函数中分配 opts to scanView

public ScanPage()
{
InitializeComponent();
scanView.Options = opts;
}

关于android - 如何正确设置 ZXingScannerView 的选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65748135/

56 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com