How to display double quotes(") Symbol in a TextView?

后端 未结 9 877
天涯浪人
天涯浪人 2020-12-05 01:27

I\'m trying to display some words in double quotes, in Text view in in xml file. But its not working. Pls help me.

    

        
相关标签:
9条回答
  • 2020-12-05 02:15

    If you have a double-quote in your string, you must escape it (\"). Surrounding the string with single-quotes does not work.

    In strings.xml

    <string name="good_example">This is a \"good string\".</string>
    

    Source :http://developer.android.com/guide/topics/resources/string-resource.html

    0 讨论(0)
  • 2020-12-05 02:16

    Use single quotes to wrap the message and you can use as many double-quotes as you want inside the string.

    android:text='message "quote string 1" and "quote string 2" end message'
    
    0 讨论(0)
  • 2020-12-05 02:24

    use escape characters. To display double quote use \"

    Your code will be

    android:text="message \"quote string 1\" and "quote string 2\" end message" 
    
    0 讨论(0)
提交回复
热议问题