Android Question Auto Resize WebView based on its content

iwan.deejay

Member
Licensed User
Longtime User
No, I mean the size of the view, for example if the content height is 500px, the size of the View is also 500px, so it wll not be able to be scrolled. My plan is actually to put it on a ScrollView, with a ListView under the WebView. It behaves like a 'related articles' button in an RSS reader.
 
Upvote 0

iwan.deejay

Member
Licensed User
Longtime User
That's not what I meant. I uploaded a picture to illustrate my point. The green area is the ScrollView, the grey area is the WebView, and the blue area is the ListView. The layout height of the WebView is following the height of the HTML content.
 

Attachments

  • Illustration_WebView.jpg
    Illustration_WebView.jpg
    87.1 KB · Views: 529
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I see. This is what I understood from your first post. What I meant to say is that the WebView content size is dynamic. The user is expected to zoom and and out as needed.

You can probably inject JavaScript with WebViewExtra library and find the body height. Though I'm not sure that the result will be better than just setting the WebView size based on the device screen size.
 
Upvote 0

iwan.deejay

Member
Licensed User
Longtime User
OK, I'll try. One more question; does Basic4android accept the height unit returned by the Javascript? Or should I convert it into a different unit, so that the WebView will have the same height that is returned by the Javascript?
 
Upvote 0
Top