Percent Sign String Indicator

I have a string array in my strings.xml file that has several elements in it. Only one of the elements has several percent signs that need to be displayed. None of the tips on how to avoid this seems to work at all. \%, %% or using formatted = "false" either in a string array or in element tags. When I use \% Eclipses it shows errors with the element, if I use %%, then Eclipse is fine, but then the text displays two percent of the characters "%%". So, any ideas on how to avoid the% sign in strings.xml?

<string-array name="details">
     <item>Placement of things</item>
     <item>Percentage of times placed is 30% 
         and percentage of times release 50%</item>
</string-array>
+5
source share
5 answers

, eclipse SDK android . eclipse 3.6.2 android sdk r10. , - , , / .

, , % , CDATA, SDK Eclipse.

+1

ADT SDK? Mine . %.

, CDATA?

<string-array name="details">
     <item>Placement of things</item>
     <item><![CDATA[Percentage of times placed is 30% 
             and percentage of times release 50%]]></item>
</string-array>
+3

, , JB 4.1.2.
:

<string-array name="percentage">
    <item>a. 100%</item>            <!-- unknownFormatConversionException -->
    <item>b. 90&#37;</item>         <!-- unknownFormatConversionException -->
    <item>c. 80%%</item>            <!-- "somewhere" a double %% appears -->
    <item>d. 60\%</item>            <!-- no % appears -->
    <item>e. 40\%%</item>           <!-- unknownFormatConversionException -->
    <item>f. 30%\%</item>           <!-- unknownFormatConversionException -->
    <item><![CDATA[g. 20%]]></item> <!-- unknownFormatConversionException -->
    <item formatter="false>h. 10%</item>    <!-- unknownFormatConversionException -->
</string-array>

emlators , ICS 4.0 , Galaxy-S GB 2.3.5, ICS FormatConversionExceptions , Nexus S JB 4.1.2.
, : !

<item>a. 100</item>
<item>b. 90</item>
...

, , , !

ADT Build: v22.0.1-685705 Ubuntu 13.04
: Nexus S JB 4.1.2, Samsung Galaxy S GB 2.3.5

+1

-

U+FE6A ﹪ small percent sign (HTML &#65130; )
U+FF05 % full-width percent sign (HTML &#65285;)

XML

    <string-array name="details">
         <item>Placement of things</item>
         <item>Percentage of times placed is 30&#65130; 
             and percentage of times release 50&#65130;</item>
    </string-array>

+1

What worked for me was a newline declaration in strings.xml with percent signs and the attribute formatted = "false"

<string name="percents" formatted="false">10&#37; is not 20&#37;</string

And then in arrays.xml

<string-array name="my_array">
    <item>@string/percents</item>
    ...
0
source

All Articles