How to disable emojis programmatically in Android

后端 未结 7 964
走了就别回头了
走了就别回头了 2020-12-06 02:11

I want to hide emojis and auto suggestions from keyboard programmatically. Its working in some Android devices but not in all devices. here\'s my code for hide auto suggesti

相关标签:
7条回答
  • 2020-12-06 02:50

    For Android

    
    mEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD| TEXT_MULTILINE); 
    

    TYPE_TEXT_VARIATION_VISIBLE_PASSWORD - We use Password char as Text input for EditTest. It doesn't have emojis and email keys like .com and @ keys TEXT_MULTILINE - This will change the keyboard layout button [Done] or [->] to [Enter] key so we can use multi line text or new line feature.

    In Xamarin Form

    Create a CustomRender and in OnElementChanged method

    
    protected override void OnElementChanged(ElementChangedEventArgs e)
            {
                base.OnElementChanged(e);
    
                    if (Control != null)
                    {
                        Control.ImeOptions = Android.Views.InputMethods.ImeAction.Done;
                        Control.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationVisiblePassword| Android.Text.InputTypes.TextFlagMultiLine;
                        Control.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                    }
                }
    
    0 讨论(0)
提交回复
热议问题