development

TextView에서 큰 따옴표 ( ") 기호를 표시하는 방법은 무엇입니까?

big-blog 2020. 9. 8. 21:36
반응형

TextView에서 큰 따옴표 ( ") 기호를 표시하는 방법은 무엇입니까?


xml 파일의 텍스트보기에서 일부 단어를 큰 따옴표로 표시하려고합니다. 그러나 작동하지 않습니다. Pls 도와주세요.

    <TextView 
    style="@style/TextStyle" 
    android:text="message "quote string 1" and "quote string 2" end message" 
    android:id="@+id/lblAboutPara3" 
    android:autoLink="web"/>    

누구든지 이것에 대한 해결책을 알고 있습니다 .............


에서 strings.xml, 당신은 단순히 백 슬래시 특수 문자 (예 : 큰 따옴표)를 탈출 할 수 있습니다 :

"message \"quote string 1\" and \"quote string 2\" end message"

그러나 뷰 xml (예 :) layout.xml에서는 HTML 문자 엔티티 (예 :)를 사용해야합니다 &quot;.

"message &quot;quote string 1&quot; and &quot;quote string 2&quot; end message"

자세한 내용은 http://developer.android.com/guide/topics/resources/string-resource.html을 방문 하십시오.


&quot;이 하드 코드 문제를 해결 하려면 기호를 사용하십시오. :)

android:text="message &quot;quote string 1&quot;" 

를 사용하십시오 escape characters. 큰 따옴표 사용을 표시하려면\"

귀하의 코드는

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

시도하십시오

<TextView 
style="@style/TextStyle" 
android:text='message \"quote string 1\" and \"quote string 2\" end message' 
android:id="@+id/lblAboutPara3" 
android:autoLink="web"/> 

TextView.setText(Html.fromHtml("&ldquo; " + "YOUR TEXT" + " &rdquo;"));

<TextView 
style="@style/TextStyle" 
android:text='message "quote string 1" and "quote string 2" end message' 
android:id="@+id/lblAboutPara3" 
android:autoLink="web"/> 

모든 xml 파일에서 유니 코드를 사용할 수 있습니다.

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

http://www.fileformat.info/info/unicode/char/0022/index.htm C / C ++ / Java 소스 코드 까지 아래로 스크롤 합니다.


문자열에 큰 따옴표가 있으면이를 이스케이프 (\ ") 해야합니다 . 문자열을 작은 따옴표로 묶는 것은 작동하지 않습니다.

strings.xml에서

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

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


작은 따옴표를 사용하여 메시지를 래핑하고 문자열 안에 원하는만큼 큰 따옴표를 사용할 수 있습니다.

android:text='message "quote string 1" and "quote string 2" end message'

참고 URL : https://stackoverflow.com/questions/6421507/how-to-display-double-quotes-symbol-in-a-textview

반응형