简体   繁体   English

Android TextView 显示奇怪的文字

[英]Android TextView displays strange text

I have written an application where I need to show in a TexView text coming from the server.我编写了一个应用程序,我需要在来自服务器的TexView文本中显示。 I am experiencing a strange behavior when the text is set on the TextView .TextView上设置文本时,我遇到了一种奇怪的行为。

For example, I am receiving "español" from server but the Textview display "espacol" is there a way to fix the encoding or perhaps display "spannish" without mapping the texts in the application.例如,我从服务器接收“español”,但 Textview 显示“espacol”有办法修复编码或显示“spannish”而不映射应用程序中的文本。

Any help will be greatly appreciated.任何帮助将不胜感激。

You can use String.format() with Locale what you want.您可以将 String.format() 与 Locale 一起使用。

For example;例如;

String text = String.format(Locale.ENGLISH, "%d", item.getText());
textView.setText(text);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM