How to display double quotes(") Symbol in a TextView?
I'm trying to display some words in double quotes, in Text view in in xml file. But its not working. Pls help me.
<TextView
style="@style/TextStyle"
android:text="message "quote string 1" and "quote string 2" end message"
android:id="@+id/lblAboutPara3"
android:autoLink="web"/>
Any one knows solution for this.............
Solution 1:
In the strings.xml
, you can simply escape special characters (eg double quotes) with a backslash :
"message \"quote string 1\" and \"quote string 2\" end message"
But in views xml (eg layout.xml
), you have to use HTML character entities (like "
) :
"message "quote string 1" and "quote string 2" end message"
For more, visit http://developer.android.com/guide/topics/resources/string-resource.html
Solution 2:
Use "
symbol to solve this hardcode problem :)
android:text="message "quote string 1""
Solution 3:
use escape characters
. To display double quote use \"
Your code will be
android:text="message \"quote string 1\" and "quote string 2\" end message"
Solution 4:
Please try
<TextView
style="@style/TextStyle"
android:text='message \"quote string 1\" and \"quote string 2\" end message'
android:id="@+id/lblAboutPara3"
android:autoLink="web"/>