如何在 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>

问题是<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>

然后将其添加到您的TextView android:textStyle="italic"

最新更新