Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
panelIconIdatlassian-info
panelIcon:info:
bgColor#E6FCFF

You might want to pack additional controls like buttons or views along with the Anyline ScanView in your scan Activity. In this case you would have to use the Anyline ScanView as a custom control instead of a page.

You can easily configure this by using ViewRenderer instead of PageRenderer as shown in the examples below.

Table of Contents
minLevel1
maxLevel6
outlinefalse
styledefault
typelist
printablefalse

...

Code Snippet for Android

Code Block
breakoutModewide
languagec#
using System;
using Android.App;
using Android.Content;
using Android.Views;
using IO.Anyline.Plugin;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(MyBarcodeScannerView), typeof(MyBarcodeScannerViewRenderer))]
namespace Anyline.Droid
{
public class MyBarcodeScannerViewRenderer : ViewRenderer, IScanResultListener
{
    private Android.Views.View view;
    private ScanView scanView;

    public MyBarcodeScannerViewRenderer(Context context) : base(context)
    {

    }

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> args)
    {
        base.OnElementChanged(args);

        if (args.OldElement != null || Element == null)
        {
           return;
        } 
        InitializeAnyline();
    }
...

...

Code Snippet for iOS

Code Block
breakoutModewide
languagec#
using Xamarin.Forms.Platform.iOS;
using AnylineXamarinSDK.iOS;
using CoreGraphics;
using Foundation;
using System;
using UIKit;
using Xamarin.Forms;

[assembly: ExportRenderer(typeof(MyBarcodeScannerView), typeof(MyBarcodeScannerViewRenderer))]
namespace Anyline.iOS
{
    public class MyBarcodeScannerViewRenderer : ViewRenderer
    {
        private bool initialized;
    
        private ALScanView _scanView;
        ScanResultDelegate _resultDelegate;

        protected override void OnElementChanged(ElementChangedEventArgs<View> args)
        {
            base.OnElementChanged(args);

            if (args.OldElement != null || Element == null)
            {
                return;
            }
            InitializeAnyline(this);
        }
...

...