我可以阻止来自Xamarin.forms的键盘建议吗 [英] Can I prevent keyboard suggestions from Xamarin.forms

查看:84
本文介绍了我可以阻止来自Xamarin.forms的键盘建议吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xamarin.forms来开发Android应用程序,并且需要防止在文本字段上提出完成建议.在香草Android中,我会将输入类型设置为type_text_flag_no_suggestions.我可以使用xaml从xamarin.forms进行此布局吗?

解决方案

在构建页面用户界面的代码中,将Keyboard属性添加到Entry,然后使用Create方法指定KeyboardFlags枚举的None常量.这指定在用户输入的文本上将不提供建议的单词补全.

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

注意:此标志还将禁用您的其他标志.

尚未更新文档,但现在添加了此标志检查 github ./p>

其他参考:

  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

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?

解决方案

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

这篇关于我可以阻止来自Xamarin.forms的键盘建议吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆