protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_bcr_customview); linearLayout = (FrameLayout)FindViewById(Resource.Id.rim); light_layout = (View)FindViewById(Resource.Id.light_layout); img = (ImageView)FindViewById(Resource.Id.imageButton2); callback = new CustomViewBcrResultCallback(this); // Calculate the coordinate information of the custom interface Rect mScanRect = CreateScanRectFromCamera(); remoteView = new CustomView.Builder() .SetContext(this) // Set the rectangular coordinate setting of the scan frame, required, otherwise it will not be recognized. .SetBoundingBox(mScanRect) // Set the type of result that the bank card identification expects to return. // MLBcrCaptureConfig.ResultSimple:Only identify the card number and validity period information. // MLBcrCaptureConfig.ResultAll:Identify information such as card number, expiration date, issuing bank, issuing organization, and card type. .SetResultType(MLBcrCaptureConfig.ResultSimple) // Set result monitoring .SetOnBcrResultCallback(callback).Build(); // External calls need to be made explicitly, depending on the life cycle of the current container Activity or ViewGroup remoteView.OnCreate(savedInstanceState); FrameLayout.LayoutParams lparams = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); linearLayout.AddView(remoteView, lparams); // Draw custom interface according to coordinates // In this step, you can also draw other such as scan lines, masks, and draw prompts or other buttons according to your needs. AddMainView(mScanRect); light_layout.Click += delegate { remoteView.SwitchLight(); isLight = !isLight; if (isLight) { img.SetBackgroundResource(Resource.Drawable.rn_eid_ic_hivision_light_act); } else { img.SetBackgroundResource(Resource.Drawable.rn_eid_ic_hivision_light); } }; }