簡體   English   中英

在Android文本視圖中顯示的奇怪字符

[英]Strange Characters Showing in Android Text View

我有一個文本視圖,其中將幾個字符顯示為矩形,但我無法弄清楚它們的來源。 有任何想法嗎?

這是帶有文本的XML:

<item>
Five cents per gallon discount. Go online to www.amerigas.com or yellow pages for the closest AmeriGas location.
\n\n
    
    Offers subject to change without notice, some restrictions may apply, contact store for details. Offer does not apply to fixed price customers. You must provide your Farm Bureau membership number to your AmeriGas dealer prior to delivery of your propane in order to receive the discount.\n
</item>

這是屏幕截圖:

在此處輸入圖片說明

編輯:在XML中,我注意到當我將其粘貼到此處時,在Offers之前是一個很大的空間,這是字符顯示的地方。 但是,該空間不會顯示在我的編輯器中。

我的猜測是,在XML文件中\\n\\n之后,您有制表符或其他一些奇怪的空白字符,字體無法正確處理。 用規則的空間替換它們,小盒子應該消失了。

您需要替換特殊字符\\ n。
只要這樣做:

string = string.replace("\\\n", System.getProperty("line.separator"));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM