多余的换行符文本时结束 [英] Extra line breaks at end of text

查看:232
本文介绍了多余的换行符文本时结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎得到什么似乎像一些额外的行使用此方法来设置的文本后,打破了的TextView

I seem to be getting what seems like some extra line breaks after using this method to set the text of a TextView

message.setText(Html.fromHtml( message ));

我怎样才能删除这些?他们会得到扭曲我的布局,因为它增加了两个额外的线路输出。

How can I remove these? They cause my layout to get warped since it adds two extra lines to the output.

该字符串是通过 Html.toHtml保存到我的SQLite数据库(editText.getText()).trim();

初​​始字符串输入:你好

Initial string input : hello

日志消息变量输出:< p DIR =升>&打招呼LT; / P>

推荐答案

看起来像toHtml承担一切都应该在< P> 标记。我脱掉的开始和结束< P> <写入之前标签; / P&GT数据库。

Looks like toHtml assumes everything should be in a <p> tag. I'd strip off the beginning and ending <p> and </p> tags before writing to the database.

这篇关于多余的换行符文本时结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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