I'm trying to justify text by using a WebView
and formatting a String resource with HTML as saw in some example:
<string name="dTxt">
<html>
<head></head>
<bodystyle text-align:justify=""><body> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc pellentesque, urna nec hendrerit pellentesque, risus massa </body>
</bodystyle>
</html>
</string>
ADT refuses to parse the Strings document with following error:
W/ResourceType( 2612): Bad XML block: header size 296 or total size 6144712 is larger than data size 0
What is wrong here?
njzk2 is right, < and > are forbidden to use them directly as string. However, you can wrap the HTML in CDATA:
<string name="dTxt">
<![CDATA[
<html>
<head></head>
<bodystyle text-align:justify="">
<body> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc pellentesque, urna nec hendrerit pellentesque, risus massa
</body>
</bodystyle>
</html>
]]>
</string>
try
these string Resource with Html.fromHtml(source)
inside your java code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With