2013-06-21 16 views
0

與資源等的末尾添加一個打破空間。我如何在Android的串種源

<string name="str">ends with a space&#160;</string> 

保留空間,但android將它視爲一個沒有破壞的空間。

有沒有一種方法來指定資源字符串末尾的中斷空間?這是一個庫函數,所以我不知道可能在資源中指定了哪些字符串。

顯然我已經考慮:

<string name="str">ends with a space£</string> 
<string name="my_breaking_space_at_end_of_android_resource">£</string> 

,並使用正則表達式。

回答

1

你似乎已經嘗試了很多東西。您也可以嘗試以下方法:

1)只是在頂端空間和雙引號引起整個字符串:

<string name="foo">"End with space "</string>. 

2)還沒有嘗試this答案,它說嘗試以下:

Insert \u0020 directly in the XML for a blank you would like to preserve:

<string name="foo">End with space \u0020</string> 

希望任這可以幫助你。

+0

這兩種方法的工作:) –