Android WebView does not wrap text

I searched the Internet for a solution, but cannot find it.

I have a webview that displays text, just text. I want to wrap text in a WebView, is this possible, or how?

And I want the user to be able to select specific text in the WebView and make it so that he can send the selected text via SMS, is this possible?

+4
source share
3 answers

I have found a solution. You must add the div tag to your web document and then add the css class. I have done this:

<div class="wrap"> 

with css class as follows:

 .wrap { word-wrap:break-word; } 
+5
source

If the content in WebView is what you yourself created or control, use a stylesheet optimized for mobile devices, or you can use jTouch or jQuery Mobile

+1
source

If your content is literally plain text (without HTML markup), then WebView will treat it as pre-formatted text and will not wrap or insert lines.

Try wrapping the text in an HTML wrapper:

 <html><body>My text goes here</body></html> 
0
source

All Articles