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

后端 未结 9 876
天涯浪人
天涯浪人 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:00

    You can use Unicode in any xml file

    android:text="message \u0022quote string 1\u0022 and \u0022quote string 2\u0022 end message"
    

    http://www.fileformat.info/info/unicode/char/0022/index.htm there scroll down to C/C++/Java source code

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

    Use " symbol to solve this hardcode problem :)

    android:text="message "quote string 1"" 
    
    0 讨论(0)
  • 2020-12-05 02:09

    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

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

    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"/> 
    
    0 讨论(0)
  • 2020-12-05 02:10
    <TextView 
    style="@style/TextStyle" 
    android:text='message "quote string 1" and "quote string 2" end message' 
    android:id="@+id/lblAboutPara3" 
    android:autoLink="web"/> 
    
    0 讨论(0)
  • 2020-12-05 02:15
    TextView.setText(Html.fromHtml("&ldquo; " + "YOUR TEXT" + " &rdquo;"));
    
    0 讨论(0)
提交回复
热议问题