protected override void OnAttached() { var editText = Control as EditText; if (editText == null) { return; } _old = editText.InputType; editText.InputType = editText.InputType | Android.Text.InputTypes.TextFlagNoSuggestions; }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); Control.Background = Resources.GetDrawable(Resource.Drawable.codeEntry); Control.SetTextColor(Android.Graphics.Color.Black); if (Control != null && e.OldElement == null) { ((Views.CustomControls.ScanBarcodeEntry)Element).OnHideKeyboard_TriggerRenderer += MyEntryRenderer_HideKeyboard; ((Views.CustomControls.ScanBarcodeEntry)Element).OnFocused_TriggerRenderer += MyEntryRenderer_FocusControl; _inputType = Control.InputType; Element.PropertyChanged += (sender, eve) => { if (eve.PropertyName == Views.CustomControls.ScanBarcodeEntry.CanShowVirtualKeyboardPropertyName) { if (!((Views.CustomControls.ScanBarcodeEntry)Element).CanShowVirtualKeyboard) { Control.InputType = 0; } else { Control.InputType = _inputType; } } }; if (!(Element as Views.CustomControls.ScanBarcodeEntry).CanShowVirtualKeyboard) { Control.InputType = 0; } Control.EditorAction += (sender, args) => { if (args.ActionId == ImeAction.ImeNull && args.Event.Action == KeyEventActions.Down) { (Element as Views.CustomControls.ScanBarcodeEntry)?.EnterPressed(); } }; } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (Control != null && e.OldElement == null) { ((HideKeyBoardEntry)Element).OnHideKeyboard_TriggerRenderer += MyEntryRenderer_HideKeyboard; //((CustomEntry)Element).OnFocused_TriggerRenderer += MyEntryRenderer_FocusControl; _inputType = Control.InputType; Element.PropertyChanged += (sender, eve) => { if (eve.PropertyName == HideKeyBoardEntry.CanShowVirtualKeyboardPropertyName) { if (!((HideKeyBoardEntry)Element).CanShowVirtualKeyboard) { Control.InputType = 0; } else { Control.InputType = _inputType; } } }; if (!(Element as HideKeyBoardEntry).CanShowVirtualKeyboard) { Control.InputType = 0; } /*Control.EditorAction += (sender, args) => * { * if (args.ActionId == ImeAction.ImeNull && args.Event.Action == KeyEventActions.Down) * { * (Element as CustomEntry)?.EnterPressed(); * } * };*/ } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (e.OldElement == null) { var gradientDrawable = new GradientDrawable(); gradientDrawable.SetCornerRadius(60f); gradientDrawable.SetStroke(5, Android.Graphics.Color.Black); gradientDrawable.SetColor(Android.Graphics.Color.White); Control.SetBackground(gradientDrawable); Control.SetPadding(50, Control.PaddingTop, Control.PaddingRight, Control.PaddingBottom); element = (CustomEntry)this.Element; var editText = this.Control; if (!string.IsNullOrEmpty(element.Image)) { switch (element.ImageAlignment) { case ImageAlignment.Left: editText.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(element.Image), null, null, null); break; case ImageAlignment.Right: editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, GetDrawable(element.Image), null); break; } } editText.CompoundDrawablePadding = 25; Control.Background.SetColorFilter(element.LineColor.ToAndroid(), PorterDuff.Mode.SrcAtop); } if (Control != null && e.OldElement == null) { ((CustomEntry)Element).OnHideKeyboard_TriggerRenderer += MyEntryRenderer_HideKeyboard; //((CustomEntry)Element).OnFocused_TriggerRenderer += MyEntryRenderer_FocusControl; _inputType = Control.InputType; Element.PropertyChanged += (sender, eve) => { if (eve.PropertyName == CustomEntry.CanShowVirtualKeyboardPropertyName) { if (!((CustomEntry)Element).CanShowVirtualKeyboard) { Control.InputType = 0; } else { Control.InputType = _inputType; } } }; if (!(Element as CustomEntry).CanShowVirtualKeyboard) { Control.InputType = 0; } /*Control.EditorAction += (sender, args) => * { * if (args.ActionId == ImeAction.ImeNull && args.Event.Action == KeyEventActions.Down) * { * (Element as CustomEntry)?.EnterPressed(); * } * };*/ } }
public void ShowInputDialog(string title, string message, string defaultInput, Android.Text.InputTypes inputTypes, Action <string> acceptAction) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle(title); builder.SetMessage(message); var inputText = new EditText(this); inputText.SetRawInputType(inputTypes); inputText.Text = defaultInput; inputText.TextAlignment = TextAlignment.Center; builder.SetView(inputText); builder.SetPositiveButton("OK", delegate { acceptAction(inputText.Text); }); builder.SetNegativeButton("Cancel", delegate { }); Dialog dialog = builder.Create(); dialog.Show(); }