Emixam23
Emixam23

Reputation: 3964

Stretch WebView

I'm stuck on making a gif element which inherits from WebView. This "WebView" is representing the following html => String.Format(@"<html><body><img src='{0}'/></body></html>", value); where value is the URL to the GIF.

However, when I declare it with a local gif, it does work, but the focus of the webview is at the top/left. I can also move/scroll the view of the webview which overflows the limits of the screen..

So, how can I make this WebView stretch about the screen?

Upvotes: 1

Views: 1383

Answers (1)

Adam
Adam

Reputation: 16199

For your WebView make sure you have the Horizontal and Vertical Options set to stretch it to the entire screen.

<WebView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />

For your gif you will probably want the below to stretch your gif to the entire visible area.

<html><body><img src='{0}' style='width:100%;height:100%;'/></body></html>

If you want the WebView to only be the size of what inside it, then unless you want to get into some complicated javascript callbacks, I would just get the size of the gif and set the width and height request on the WebView.

Upvotes: 3

Related Questions