Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
916 views
in Technique[技术] by (71.8m points)

android - Can I prevent keyboard suggestions from Xamarin.forms

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_text_flag_no_suggestions. Can I do this from xamarin.forms using xaml for the layout?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...