XML escape characters
The numbers and string escape characters of the XML flag are as follows:
"(& #34; or & quot ;)
'(& #39; or & apos ;)
& (& #38; or & amp ;)
Lt (<) (& #60; or & lt ;)
Gt (>) (& #62; or & gt ;)
Example:
For example, the following string is defined in string. xml,
<String name = "first"> hello, everyone. Welcome to the eoeandroid community. Welcome to here! </String>
I want
Hello everyone, welcome to the eoeandroid community.
Welcome to here!
What should I do if two rows are output in the form? Add \ n, see the following:
<String name = "hello"> hello, everyone. Welcome to the eoeandroid community. \ Nwelcome to here! </String>
Tips for adding spaces before and after string. xml in android
<String name = "space"> & #160; & #160; & #160; & #160; let me see spaces </string>
& #160; this represents a space
1. If the following error occurs, you must add the Escape Character (\) to the single quotation mark signature (\):
Description Resource Path Location Type error: Apostrophe not preceded by \ (in Search 'titles) strings. xml
You only need to change the single quotes (') in the defined string (\').
2. variable Text Format (% s) Prompt:
Multiple annotations found at this line:
-Error: Multiple substitutions specified in non-positional format; did you mean to add the formatted = "false"
Attribute?
-Error: Unexpected end tag string
This is because the new SDK (although not old) uses the new version of aapt (Android project compiler), this version of aapt compilation will be more rigorous than the old version, in the latest Android development documentation, the String section describes how to set symbols such as % s. You can click to view them.
The simple solution is to replace the format of variables such as % s with % 1 $ s. % 1 indicates the variable at the first position, and $ s indicates the string type.
For example:
<String name = "welcome_messages"> Your First Var is % 1 $ s! You Second Var is % 2 $ d. </string>
XML escape characters
The numbers and string escape characters of the XML flag are as follows:
"(& #34; or & quot ;)
'(& #39; or & apos ;)
& (& #38; or & amp ;)
Lt (<) (& #60; or & lt ;)
Gt (>) (& #62; or & gt ;)
Example:
For example, the following string is defined in string. xml,
<String name = "first"> hello, everyone. Welcome to the eoeandroid community. Welcome to here! </String>
I want
Hello everyone, welcome to the eoeandroid community.
Welcome to here!
What should I do if two rows are output in the form? Add \ n, see the following:
<String name = "hello"> hello, everyone. Welcome to the eoeandroid community. \ Nwelcome to here! </String>
Tips for adding spaces before and after string. xml in android
<String name = "space"> & #160; & #160; & #160; & #160; let me see spaces </string>
& #160; this represents a space
1. If the following error occurs, you must add the Escape Character (\) to the single quotation mark signature (\):
Description Resource Path Location Type error: Apostrophe not preceded by \ (in Search 'titles) strings. xml
You only need to change the single quotes (') in the defined string (\').
2. variable Text Format (% s) Prompt:
Multiple annotations found at this line:
-Error: Multiple substitutions specified in non-positional format; did you mean to add the formatted = "false"
Attribute?
-Error: Unexpected end tag string
This is because the new SDK (although not old) uses the new version of aapt (Android project compiler), this version of aapt compilation will be more rigorous than the old version, in the latest Android development documentation, the String section describes how to set symbols such as % s. You can click to view them.
The simple solution is to replace the format of variables such as % s with % 1 $ s. % 1 indicates the variable at the first position, and $ s indicates the string type.
For example:
<String name = "welcome_messages"> Your First Var is % 1 $ s! You Second Var is % 2 $ d. </string>