简体   繁体   中英

How to Show double quotation with HTML code as text in Android (TextView) ?

I want to Show HTML code as Text in Tutorial App

String.xml

<string name="p1"><![CDATA[<html>\n<title> Font tag Example </title>\n<body>\n<font face="arial" size="1" color="blue"> WELCOME </font> <br>\n <font size="2" color="cyan"> WELCOME </font> <br>\n <pre>\n This text uses pre tag and preserves nextline and spaces\n </pre>\n </body>\n </html>]]></string>

prog1.xml

<TextView
    android:id="@+id/p1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="15dp"
    android:textSize="18sp"
    android:text="@string/p1" />

Show but without " ", Need Show with " " double quotation

显示没有双引号

require Show like this

to show double quote("") inside a textview use any of these

  • &quot;
  • \\"

here is the official android website
https://developer.android.com/guide/topics/resources/string-resource

Try it in your string.xml <string name="ffdfb">\\"ffdfb\\"</string> or <string name="ffdfb">&quot;ffdfb&quot;</string>

else try it in your xml android:text='"fvdfv"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM