开发者

Android No Break Space - how to?

开发者 https://www.devze.com 2023-04-09 09:51 出处:网络
I have 开发者_如何学编程a bug, where only on HTC Evo 4g text in EditText shows up with underscores instead of spaces Jack_Johnson, instead of Jack Johnson.The data comes from a server.

I have 开发者_如何学编程a bug, where only on HTC Evo 4g text in EditText shows up with underscores instead of spaces Jack_Johnson, instead of Jack Johnson. The data comes from a server.

How do I incorporate \u00A0 or &nbsp into the code below? Will that even fix my problem?

editName.setText(recipient.name);


Try this:

editName.setText(Html.fromHtml(recipient.name));


So you actually want to unescape the exported from the server escaped special characters? If so, Html.fromHtml won't work, but you can use StringEscapeUtils from the apache commons lang library - http://commons.apache.org/lang/

0

精彩评论

暂无评论...
验证码 换一张
取 消