java - Android add padding for spanned text -


in app, fetch , parse html content , show using spanned. use spanned that:

string html = "<p>html content</p>" spanned htmlspan = html.fromhtml(html, imageparser, null); 

i've tried use apache commons library set padding didn't work.

is there way set left , right padding?

edit: forgot mention, have images in html content. i've tried add padding textview itself, way, images have padding.

generally speaking, easiest solution display html using webview. not best solution, work css , javascript.

to apply padding on spanned text in textview can use <blockquote> html.fromhtml() convert quotespan. if don't format of span, can replace , add own implementation of leadingmarginspan. same work adding taghandler create , handle own tag on spannable string.

you can search , replace span using following

 quotespan[] spans = text.getspans(0, text.length(), quotespan.class); text.setspan(your_span, text.getspanstart(spans[0]), text.getspanend(spans[0]), 0); 

working spans poorly documented , there little tutorials, @ this further reading.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -