Can I prevent keyboard suggestions from Xamarin.forms

后端 未结 2 445
日久生厌
日久生厌 2021-01-19 19:01

I\'m trying to use xamarin.forms to develop an Android app and need to prevent completion suggestions on a text field. In vanilla Android I would set the inputtype to type_t

相关标签:
2条回答
  • 2021-01-19 19:45

    In the code building the user interface for a page, add a Keyboard property to an Entry, and use the Create method to specify the None constant of the KeyboardFlags enumeration. This specifies that no suggested word completions will be offered on text that the user enters.

    Content = new StackLayout {
        Padding = new Thickness(0,20,0,0),
        Children = {
            new Entry { Keyboard = Keyboard.Create(KeyboardFlags.None) }
        }
    };
    

    Note: this flag will also disable your other flags.

    documentation is not updated but this flag is now added check github.

    Additional references:

    1. https://stackoverflow.com/a/26978071/3758024
    2. https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/choose-keyboard-for-entry/#Specifying_additional_keyboard_options
    0 讨论(0)
  • 2021-01-19 19:46

    You mean you want to disable Suggestions shown on the Keypad while you input text in an Entry. In your XAML code just add property Keyboard="Email" in your Entry.

    So Finally your code will look like

    <Entry Placeholder="Enter the word" Keyboard="Email" />
    

    Hope this answers the question.

    0 讨论(0)
提交回复
热议问题