I ask for your help. Not so long ago there was a problem with the generation of this very barcode, which was resolved. Here is a link to the discussion: Why is the bar code generated by Zxing displayed in a narrow bar?

Similarly, I try to display the barcode in my application, on the third page of the account - and fail. In the version under the androyd - the bar code is not generated. In the UWP version - everything works fine!

Yes, I can not figure out where to start digging ... :( What could be the problem?

Here is the code for the barcode page:

public Page3() { InitializeComponent(); var qrCode = new ZXingBarcodeImageView() { BarcodeFormat = BarcodeFormat.CODE_39, BarcodeOptions = new QrCodeEncodingOptions() { Height = 100, Width = 350 }, BarcodeValue = Collector.StrihKod, //BarcodeValue = KOD, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; Label label01 = new Label() { Text = Collector.StrihKod, BackgroundColor = Color.FromHex("#77d065") }; Label label02 = new Label() { Text = "Where is a barcode ?", BackgroundColor = Color.FromHex("#77d065") }; StackLayout stack = new StackLayout() { Children = { label01, qrCode, label02 } }; this.Content = stack; } 

Here is the result of the code

Page3

I would be very happy with any idea! Thank!

  • Look at this answer on SOen can help: stackoverflow.com/questions/49105986/… - Emigrant
  • Thanks for responding! Yes, not finding a similar situation and sensible description of the product, I began to try all the solutions that came across on the subject and look at the result. And it turned out to find a solution. - Andrey

1 answer 1

Thanks to everyone who tried to help, the answer to the question turned out to find myself ... just by chance in general, like a similar question on the subject of ZXing. I hope that someone will come in handy. Found the solution on Ineta. Link to the original.

I added to the page layout:

 <zxing:ZXingBarcodeImageView x:Name="barcode" BarcodeFormat="CODE_39" HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="300" HeightRequest="150" Margin="5"/> 

And in the page code:

 barcode.BarcodeOptions = new ZXing.Common.EncodingOptions() { Height = 100, Width = 350 }; barcode.BarcodeValue = Collector.StrihKod; 

And everything turned out!

enter image description here