<B> </B> bold font
<I> </I> italic font
<U> </u> underline the font.
\ N line feed
\ U0020 indicates space
\ U2026 indicates the ellipsis
Use & lt; B> and & lt; B> to print the text like <B> </B>. "& lt;" indicates the meaning of "<;
Use textview. settext (html. fromhtml ("Hello <B> world </B>, <font size = \" 3 \ "color = \" Red \ "> analysisxmlactivty! </Font> "); Set effects similar to those in HTML.
If you need to format your string using string. Format (string, object...), you can put the format parameter in your string. See the following example:
<String name = "welcome_messages"> hello, % 1 $ s! You have % 2 $ d new messages. </string>
In this example, the formatted string has two parameters, % 1 $ S is a string % 2 $ D is a floating point number, you canProgramFormat the string according to the parameters in the following method:
Resources res = getresources ();
String text = string. Format (res. getstring (R. String. welcome_messages), username, mailcount );
As mentioned in the example, I need to replace % s with % 1 $ S. After the modification, the program is compiled and started successfully.
Question added: how to use the "%" in <string> </string>
There are two ways to choose from
1. Use % to indicate 1%, which is the same as the conversion symbol \.
2. if your string does not need to be formatted, you can add an attribute on your <string Tag: formatted = "false" for example, <string name = "test" formatted = "false"> % test % </string>.