HTML in Strings.xml | Sololearn: Learn to code for FREE!
0

HTML in Strings.xml

how to use html tags in string.xml for android ?

25th Apr 2019, 4:54 AM
Aamir Naseer
Aamir Naseer - avatar
2 odpowiedzi
0
Check the following answer from stackoverflow (https://stackoverflow.com/questions/13425002/android-html-in-strings-xml) : " The best way to add html source code in strings.xml is to use <![CDATA[html source code]]>. Here is an example: <string name="html"><![CDATA[<p>Text</p>]]></string> Then you can display this html in TextView using: myTextView.setText(Html.fromHtml(getString(R.string.html))); If you have links in your html and you want them to be clickable, use this method: myTextView.setMovementMethod(LinkMovementMethod.getInstance()); " ------------- edited : sorry I didn't know it was old technique
25th Apr 2019, 7:13 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
0
cdata technic is old now its not working
25th Apr 2019, 7:14 AM
Aamir Naseer
Aamir Naseer - avatar