我怎样才能进入角色"<"在strings.xml中?

问题描述:

我想输入字符串 - <的strings.xml 在eclipse文件,该字符串有字符< ,我难道没有错误不添加到XML文件!我甚至想通过逃逸\ 字符:

I want to enter string " -< " in strings.xml file in eclipse, the string has character < and I couldn't add it to xml file without error! I even tried to escaping by \ character:

<string name="search_target_arrow"> -\< </string>

或围护它如下:

<string name="search_target_arrow">" -< "</string>

但没有奏效。后来终于在这里样的用户帮助,我发现,这将是在XML输入字符等正确的方式:

but none worked. Then finally with help of kind users here I found that this would be the correct way to enter such chars in xml:

<string name="search_target_arrow"> -&amp;lt; </string>

但现在,当我得到这个资源在我的code:

but now when I get this resource in my code:

getResources().getString(R.string.search_target_arrow);

并将其设置为一个TextView,它显示 - &放大器; LT; 在屏幕上!如何获得由code原有的特色?我应该做一些相关的HTML吗?!

and set it to a TextView, It shows -&lt; on screen! How to get original character by code? should I do something related to HTML?!

如果您使用的是Eclipse,然后用鼠标右键单击的strings.xml和放大器;与机器人通用的XML编辑器和功放打开它;加上从那里它会处理转义为你。

If you are using eclipse then right click on strings.xml & open it with "Android Common XML Editor" & add from there it will handle escaping for you.