ZXing ZXingScannerPage:手电筒/手电筒不工作 (Xamarin.Forms)
ZXing ZXingScannerPage: Torch / Flashlight not working (Xamarin.Forms)
我想通过启动扫描仪页面来激活 torch/flashlight,但它无法正常工作。没有错误信息。
<?xml version="1.0" encoding="utf-8" ?>
<zxing:ZXingScannerPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
x:Class="de.scanner.Pages.ScanPage"
NavigationPage.HasNavigationBar="True"
NavigationPage.HasBackButton="True"
OnScanResult="Handle_OnScanResult"
IsScanning="False"
IsTorchOn="True">
</zxing:ZXingScannerPage>
Android 清单:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
从另一个页面使用 FreshMvvm:
await this.CoreMethods.PushPageModel<ScanPageModel>();
您可以改用 ZXingScannerView
并使用按钮打开手电筒。
<Button BackgroundColor="Chocolate" Clicked="Button_Clicked"/>
<zxing:ZXingScannerView x:Name="_scanView" OnScanResult="Handle_OnScanResult" IsScanning="true"
WidthRequest="200" HeightRequest="200" />
private void Button_Clicked(object sender, EventArgs e)
{
_scanView.IsTorchOn = true;
}
我想通过启动扫描仪页面来激活 torch/flashlight,但它无法正常工作。没有错误信息。
<?xml version="1.0" encoding="utf-8" ?>
<zxing:ZXingScannerPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
x:Class="de.scanner.Pages.ScanPage"
NavigationPage.HasNavigationBar="True"
NavigationPage.HasBackButton="True"
OnScanResult="Handle_OnScanResult"
IsScanning="False"
IsTorchOn="True">
</zxing:ZXingScannerPage>
Android 清单:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
从另一个页面使用 FreshMvvm:
await this.CoreMethods.PushPageModel<ScanPageModel>();
您可以改用 ZXingScannerView
并使用按钮打开手电筒。
<Button BackgroundColor="Chocolate" Clicked="Button_Clicked"/>
<zxing:ZXingScannerView x:Name="_scanView" OnScanResult="Handle_OnScanResult" IsScanning="true"
WidthRequest="200" HeightRequest="200" />
private void Button_Clicked(object sender, EventArgs e)
{
_scanView.IsTorchOn = true;
}