Xamarin.forms 以Xamarin格式生成条形码

Xamarin.forms 以Xamarin格式生成条形码,xamarin.forms,Xamarin.forms,我需要在我的Xamarin.Forms项目中生成条形码。我找到了扫描条形码的样品。有人试图生成条形码吗?使用ZXing库,您不仅可以扫描条形码,还可以生成条形码 示例回购可以在这里找到:创建回购是为了回答StackOverflow上关于条形码模糊的另一个问题。但它也展示了如何生成条形码 基本上,您只需将ZXing库安装到项目中,并向页面添加ZXingBarcodeImageView <ContentPage xmlns="http://xamarin.com/schemas/2014/fo

我需要在我的
Xamarin.Forms
项目中生成
条形码。我找到了扫描条形码的样品。有人试图生成条形码吗?

使用ZXing库,您不仅可以扫描条形码,还可以生成条形码

示例回购可以在这里找到:创建回购是为了回答StackOverflow上关于条形码模糊的另一个问题。但它也展示了如何生成条形码

基本上,您只需将ZXing库安装到项目中,并向页面添加
ZXingBarcodeImageView

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:BlurryZXing" x:Class="BlurryZXing.MainPage" xmlns:forms="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:zx="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:zxcm="clr-namespace:ZXing.Common;assembly=zxing.portable">
    <forms:ZXingBarcodeImageView 
        IsVisible="True"
        x:Name="QRCodeView"
        BarcodeFormat="QR_CODE" 
        HeightRequest="300"
        WidthRequest="300"
        BarcodeValue="-1">
        <zx:ZXingBarcodeImageView.BarcodeOptions>
            <zxcm:EncodingOptions Width="300" Height="300" />
        </zx:ZXingBarcodeImageView.BarcodeOptions>
    </forms:ZXingBarcodeImageView>
</ContentPage>


使用ZXing库,您不仅可以扫描条形码,还可以生成条形码

示例回购可以在这里找到:创建回购是为了回答StackOverflow上关于条形码模糊的另一个问题。但它也展示了如何生成条形码

基本上,您只需将ZXing库安装到项目中,并向页面添加
ZXingBarcodeImageView

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:BlurryZXing" x:Class="BlurryZXing.MainPage" xmlns:forms="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:zx="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:zxcm="clr-namespace:ZXing.Common;assembly=zxing.portable">
    <forms:ZXingBarcodeImageView 
        IsVisible="True"
        x:Name="QRCodeView"
        BarcodeFormat="QR_CODE" 
        HeightRequest="300"
        WidthRequest="300"
        BarcodeValue="-1">
        <zx:ZXingBarcodeImageView.BarcodeOptions>
            <zxcm:EncodingOptions Width="300" Height="300" />
        </zx:ZXingBarcodeImageView.BarcodeOptions>
    </forms:ZXingBarcodeImageView>
</ContentPage>


如果答案是肯定的,请不要忘记接受它!如果答案是肯定的,请不要忘记接受它!
// On Android in the MainActivity.cs in the OnCreate method
ZXing.Net.Mobile.Forms.Android.Platform.Init();