2011-08-19 14 views
7

Mam textView i wklejam ciąg s jako tekst, w którym mam "znaki podwójnego cudzysłowu" Jak mogę uciec z tych znaków.Escape "" w tekście w TextView

+0

Chcesz dodać te qoutes lub usunąć te cytaty przed dodaniem ciąg TextView? –

Odpowiedz

14

Backslashing cudzysłowy nie będzie działać w układ XML. należy użyć kod HTML (Quot), podobnie jak to:

<TextView android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:text="Here goes my &quot;escaped&quot; text!" /> 

Powyższy kod wyświetli TextView zawierające:

Tu idzie mój "uciekł" tekst!

XML ma 5 of these predifined entities:

&quot; " 
&amp; & 
&apos; ' 
&lt;  < 
&gt;  >