【发布时间】:2018-06-30 20:39:58
【问题描述】:
我正在使用 Zxing.Net.Mobile.Forms 来显示条形码。我不确定如何在一页上添加其他元素以及条形码。我已经尝试在 c# 和 xaml 中添加它,但我的附加元素没有显示。我想在条码后添加标签,并在条码上方添加图片。
Barcode.xaml.cs
public partial class BarCode : ContentPage
{
ZXingBarcodeImageView barcode;
public BarCode()
{
InitializeComponent();
barcode = new ZXingBarcodeImageView
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
};
barcode.BarcodeFormat = ZXing.BarcodeFormat.CODE_128;
barcode.BarcodeOptions.Width = 300;
barcode.BarcodeOptions.Height = 150;
barcode.BarcodeOptions.Margin = 10;
barcode.BarcodeValue = Helpers.Settings.CardNumber;
Content = barcode;
}
}
Barcode.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.BarCode"
BackgroundImage="NewBg.jpg">
<ContentPage.Content>
<StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
【问题讨论】:
标签: xamarin xamarin.forms zxing