2014-02-27 61 views
-2

我該如何在android中設置長字符串值?如何在android eclipse中設置一個長字符串值?

<string name="ferrariContent1"> 
<i>Ferrari S.p.A. is an Italian sports car manufacturer based in Maranello. Founded by Enzo Ferrari in 1929, as Scuderia Ferrari, the company sponsored       drivers and manufactured race cars before moving into production      of street-legal vehicles as Ferrari S.p.A. in 1947. Fiat acquired 50% of Ferrari in 1969 and expanded its stake to 85% in 2008, which it still holds. Throughout its history, the company has been noted for its continued participation in racing, especially in Formula One, where it has had great success. Ferrari road cars are generally seen as a symbol of speed, luxury and wealth.</i> 

</string> 
+0

歡迎添加到您的StackOverflow。在做任何事之前,請花些時間閱讀[如何提問頁面](http://stackoverflow.com/questions/how-to-ask),以便您改善問題並獲得更好,更快的幫助。 –

回答

1

問題是<i>標記和%標記。您不能在本地化的字符串中定義斜體,您將不得不爲TextView設置字體。在%大關應該是&#x25;你也將不得不使用formatted=false參數:

<string formatted="false" name="ferrariContent1">Ferrari S.p.A. is an Italian sports car manufacturer based in Maranello. 
    Founded by Enzo Ferrari in 1929, as Scuderia Ferrari, the company sponsored drivers and manufactured 
    race cars before moving into production of street-legal vehicles as Ferrari S.p.A. in 1947. 
    Fiat acquired 50&#37; of Ferrari in 1969 and expanded its stake to 85&#37; in 2008, 
    which it still holds. Throughout its history, the company has been noted for 
    its continued participation in racing, especially in Formula One, where it has had great success. 
    Ferrari road cars are generally seen as a symbol of speed, luxury and wealth. 
</string> 

那麼這TextViewandroid:textStyle="italic"

+0

它幫了我很多!謝謝! – user3360087

+0

如果解決方案適合您,請使用V標記接受答案。 – Niko

相關問題