I'm using a WebView to display a formatted HTML text file with color and font size.
My problem is it keeps removing spaces form the text, like it will combine two words together. I think it is because it is trying to fit the text within the screen width. How do I fix this? Or is there a better way to display formatted text like this? (I need size, color, links, and some centered text
This question has been already asked but was not answered.
WebView removing spaces from text
I think you need load formatted local html file, so algorithm:
Parse you unformatted html data.
Format html data as you like, using .replace method
Load formatted data to your webview, like this: Load local html in WebView?
Related
I can use MathJax to render Mathematical formula in WebView (so loaded content in WebView is completely under my control). Also we know we can display HTML in TextView. Is there a way to extract typeset symbols from html page to display in TextView? Really I want to display the same thing that is displayed in WebView in TextView.
I would like knowing if it's possible to obtain the preview image (thumbnail) of any text file in Android, like PDF, DOC, TXT, PPT, PPTX, RSS or HTML.
If the response is positive, how do I can make it?
I have the preview images of video and image files, and I want to obtain the same result for text files.
Thanks for your attention, greetings.
This can be quite a problem since you need to handle every file type individually.
TXT, RSS and HTML are simple enough, you can just read them all like a text file and display the text on the screen (first X characters, for instance, either with a TextView or by manually drawing it in the onDraw method. However, if you want to render the HTML, look at this question.
PDF is another story, you need some sort of rendering endine for that, you might want to look at MuPDF.
RSS and HTML Can work the same way as a normal TXT file.
PPT, PPTX and DOC will also need a custom renderer, you might want to look at this question.
Here is why I want to do.
I have an html string extracted from a rss feed.
I want it to display nicely in a WebView embedded in my activity.
I can easily do it using the loadData() function, but the display isn't optimized for a small device : in another word I want to resize the html content not to exceed my view width.
So images, frames, tables need to be resized.
How can I do it ?
I thought I could use Google Wireless Transcoder service but it only works with urls
One option would be to use css, but it depends on the feed (each post might have different formatting / apply styles inline)
Use loadDataWithBaseURL(), with "file:///android_asset/" as the base url. Put a css file in your /project/assets folder. Inject the css file into the tag of your html.
How to read all text and images from a html page for example
http://wireless.ign.com/articles/118/1186400p1.html
Lets say i would like to get the text on the page, and the Latest images?
How would i go about doing this?
via HTTPGET Request? If so how?
How can i get this text and then do something with it and the images, like set it to a text view, and set the images to ImageView.
use below code in unix/linux
wget http://wireless.ign.com/articles/118/1186400p1.html -O test.html
Use HttpURLConnection to get the html, and then use Regex or something like JSoup or similar to parse the Html.
I want to create an app that reads and displays a big text file, so basically, it's a text file reader. There is something specific with the reader is that I would like to show a background image with the text. When the text scrolls, the image moves along with it.
I wondered what is the best practice for this? TextView? WebView? Or using SurficeView to draw the text/animation directly?
Thanks,
I would recommand a WebView. But this would be easier if you already save the large Text as a HTML-Page. You can then use the loadURL()-method to show you'r HTML-File (i guess this is for the help-page?)