How to add < and> in android strings.xml

前端 未结 3 1023
陌清茗
陌清茗 2021-01-11 11:38

I need to add in strings.xml. What is the escape sequence in order to do that? The string to

3条回答
  •  走了就别回头了
    2021-01-11 11:48

    The Android string.xml file is just a regular XML file, so you can use the XML escape characters:

    "   "
    '   '
    <   <
    >   >
    &   &
    

    Your example would become <Given Name>

    UPDATE: Furthermore you can use the HTML entities of each character, a blank space is for example , and a non-breaking space is  .

    Note that I am not entirely sure whether this is officially supported by the XML standards, or that it 'just works'...

提交回复
热议问题