Android布局中string.xml中的字符串格式

时间:2022-06-01 23:44:18

I have a string defined in my String.xml file that uses format arguments, i.e.:

我在我的String.xml文件中定义了一个使用格式参数的字符串,即:

<string name="myStr">Part No.(Part Sr. No.)</string>

I have assign string for TextView

我为TextView分配了字符串

<TextView android:text="@string/myStr"/>

There is error occurred for assign string value for TextView. How is it do format string for TextView?? Please help me.

为TextView分配字符串值时发生错误。如何为TextView格式化字符串?请帮帮我。

Thanks! Nitin

1 个解决方案

#1


2  

To allow for all characters in your string, you must mark is as not formatted:

要允许字符串中的所有字符,您必须标记为未格式化:

<string name="myStr" formatted="false">Part No.(Part Sr. No.)</string>

#1


2  

To allow for all characters in your string, you must mark is as not formatted:

要允许字符串中的所有字符,您必须标记为未格式化:

<string name="myStr" formatted="false">Part No.(Part Sr. No.)</string>