如何删除EditText中的Android自动建议下划线? [英] How to remove Android auto-suggest underlining in EditText?

查看:297
本文介绍了如何删除EditText中的Android自动建议下划线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用EditText编写一些文本. Android的自动建议功能强调了这个词,直到我们踏入太空为止.现在,如果我输入的单词不带空格,则结果文本将带有下划线.这是因为我使用了Html.toHtml(view.getText()).

I'm using an EditText to write some text. Android's auto-suggest underlines the word, until we hit space. Now, if I enter the word without the space, the resulting text has an underline. It's because I use Html.toHtml(view.getText()).

现在,我期望有一些答案,例如禁用自动建议或使用view.getText().toString(),但我都需要它们.我需要自动建议功能以及文本格式.解决此问题的一个示例是Gmail应用程序.您可以在EditText框中输入所需内容,然后发送电子邮件时不带下划线.

Now, there are a few answers I'll be expecting such as disabling auto-suggestion or using view.getText().toString(), but I need them both. I need the auto-suggestion feature as well as the formatting of the text. An example which solves this problem is the Gmail app. You can write whatever you want in the EditText box and it sends the email without the words being underlined.

推荐答案

在getText()之前使用此方法. 这是最简单,最正式的方式.

Use this just before you getText(). This is the most straightforward and the official way.

 edittext.clearComposingText();

这篇关于如何删除EditText中的Android自动建议下划线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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