2013-05-29 114 views

回答

3

不幸的是,你只是不能從strings.xml AFAIK那樣做。

你只剩下兩件事中的一件。

Adding the Unicode character within java to the String in the XML file: 

String str = "\u00A9" + getContext().getString(R.string.your_string); 

Entering the text as HTML in java: 

yourTextView.setText(Html.fromHtml("your chars"); 

希望這是有用的。

參考Unicode characters not displayed in TextView.setText

2

試試這個,我希望這會工作。

myTextView.setText(Html.fromHtml("your_string")); 
1

當使用從我的資產文件夾加載的.txt文件中的內容設置文本視圖時,我遇到了類似的問題。

我嘗試了一些東西來搞亂編碼,但沒有結果。

最後問題結果不是我的Android代碼,而是涉及到加載的文本文件。 顯然notepad無法處理通過html的副本。 使用自定義編輯器(我使用Sublime)重新創建文本文件時,「?」在ë,ä,ù,...上解析爲我的TextView中的正確字符。