private void InitScan()
        {
            var integrator = new IntentIntegrator(this);

            integrator.SetPrompt("请扫描");
            integrator.SetOrientationLocked(true);
            integrator.SetCameraId(0);
            integrator.SetBeepEnabled(false);
            integrator.SetCaptureActivity(new ScanActivity().Class);
            integrator.InitiateScan();
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            LinearLayout ll     = new LinearLayout(this);
            Button       button = new Button(this);

            button.Text   = "Click to Scan using Zxing";
            button.Click += (s, e) =>
            {
                IntentIntegrator intentIntegrator = new IntentIntegrator(this);
                intentIntegrator.InitiateScan();
            };
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent,
                                                                         Android.Views.ViewGroup.LayoutParams.WrapContent);
            ll.AddView(button, lp);
            SetContentView(ll);
        }