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

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

问题描述

我正在尝试使用 xamarin.forms 来开发 Android 应用程序,并且需要阻止对文本字段的完成建议.在原生 Android 中,我会将 inputtype 设置为 type_text_flag_no_suggestions.我可以在 xamarin.forms 中使用 xaml 进行布局吗?

解决方案

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

Content = new StackLayout {填充 = 新厚度(0,20,0,0),儿童 = {新条目 { 键盘 = Keyboard.Create(KeyboardFlags.None) }}};

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

文档 未更新,但现在添加了此标志检查 https://stackoverflow.com/a/26978071/3758024

  • 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天全站免登陆