private void InitBottlecapResultView() { RelativeLayout mainLayout = (RelativeLayout)FindViewById(Resource.Id.main_layout); _bottlecapResultView = new OcrResultView(this) { Visibility = ViewStates.Invisible }; _bottlecapResultView.Bg.SetImageResource(Resource.Drawable.bottle_background); //register click event _bottlecapResultView.Click += (sender, args) => { _bottlecapResultView.Visibility = ViewStates.Invisible; _scanView.StartScanning(); }; //set text properties _bottlecapResultView.ResultText.TextAlignment = TextAlignment.Center; _bottlecapResultView.ResultText.TextSize = 18; _bottlecapResultView.ResultText.Typeface = Android.Graphics.Typeface.DefaultBold; _bottlecapResultView.ResultText.SetTextColor(Android.Graphics.Color.Black); var textParams = (RelativeLayout.LayoutParams)_bottlecapResultView.ResultText.LayoutParameters; //center text textParams.AddRule(LayoutRules.CenterHorizontal, (int)LayoutRules.True); textParams.AddRule(LayoutRules.CenterVertical, (int)LayoutRules.True); _bottlecapResultView.ResultText.LayoutParameters = textParams; //center the result in the parent RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.CenterInParent, (int)LayoutRules.True); mainLayout.AddView(_bottlecapResultView, layoutParams); }
private void InitVoucherCodeResultView() { RelativeLayout mainLayout = (RelativeLayout)FindViewById(Resource.Id.main_layout); _voucherCodeResultView = new OcrResultView(this) { Visibility = ViewStates.Invisible }; _voucherCodeResultView.Bg.SetImageResource(Resource.Drawable.gift_card_background); //register click event _voucherCodeResultView.Click += (sender, args) => { _voucherCodeResultView.Visibility = ViewStates.Invisible; _scanView.StartScanning(); }; //set text properties _voucherCodeResultView.ResultText.TextAlignment = TextAlignment.TextStart; _voucherCodeResultView.ResultText.TextSize = 18; _voucherCodeResultView.ResultText.Typeface = Android.Graphics.Typeface.Default; _voucherCodeResultView.ResultText.SetTextColor(Android.Graphics.Color.White); //set text position ((RelativeLayout.LayoutParams)_voucherCodeResultView.ResultText.LayoutParameters) .SetMargins(0, DimensUtil.GetPixFromDp(this, 35), 0, 0); //center text ((RelativeLayout.LayoutParams)_voucherCodeResultView.ResultText.LayoutParameters) .AddRule(LayoutRules.CenterHorizontal, (int)LayoutRules.True); //center the result in the parent RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.CenterInParent, (int)LayoutRules.True); mainLayout.AddView(_voucherCodeResultView, layoutParams); }
private void InitDriverLicenseResultView() { RelativeLayout mainLayout = (RelativeLayout)FindViewById(Resource.Id.main_layout); _driverLicenseResultView = new DrivingLicenseResultView(this) { Visibility = ViewStates.Invisible }; //register click event _driverLicenseResultView.Click += (sender, args) => { _driverLicenseResultView.Visibility = ViewStates.Invisible; _scanView.StartScanning(); }; //center the result in the parent RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.CenterInParent, (int)LayoutRules.True); mainLayout.AddView(_driverLicenseResultView, layoutParams); }