Search...

Monday, February 27, 2012

How to use Special Chracter’s in Android Layout XML?


Backslashing double quotes will not work in a XML layout. You should use the HTML-code (quot), like this:
<TextView android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:text="Here goes my &quot;escaped&quot; text!" />

The above code will display a TextView containing:
Here goes my "escaped" text!
XML has 5 of these predifined entities:
&quot;   "
&amp;    &
&apos;   '
&lt;     <
&gt;     >

No comments:

Post a Comment