Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

WebView size/visualization problem

$
0
0

Hello,

For the past couple of days I've been trying to make a WebView in my Xamarin.Forms project behave the way I want it to. Sadly without success... So any help would be appreciated.

The scenario:
I have a "Detail View" which is used for displaying product, news etc. details and is populated by a JSON/REST API. The content which I want to show in the WebView comes from a REST API and is in HTML format. So far, so good...

Rough structure of the Detail View:

  • ScrollView

    • ImageGallery
    • Title Labels
    • WebView

My problems (see the attached image):
The content that I want to show in the Webview might be two lines long or ten paragraphs long. That means I can't set a fixed height value for the WebView, otherwise one would be forced to use the WebViews internal ScrollView. Secondly the width of the WebView expands beyond the visible area, which is also a problem.

I've tried to fix these problems with a custom iOS WebViewRenderer but no luck so far. I've managed to get the height of the content after it has been loaded by running JavaScript commands but this feels more like a hack than a real solution.

So...
How can I set the height of a WebView based on the content?
How can I disable the internal ScrollView of the WebView?
How can I can set the correct width?

Do you have a different approach?

Please bear in mind that I'm relativ inexperienced with Xamarin and Xamarin.Forms platform.

image

Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles