Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webview can't scroll

I've got this Xamarin Forms page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:TestApp1"
             x:Class="TestApp1.MainPage">
<ContentPage.Content>
  <StackLayout Orientation="Vertical">
    <WebView Source="http://www.google.de" HeightRequest="3000" WidthRequest="100"/>
  </StackLayout>
</ContentPage.Content>
</ContentPage>

When I open my app, enter anything in the google prompt, I can't scroll on the results page. How do I enable this?

When I google for "xamarin webview enable scrolling" I only find information about disabling it...

like image 895
Ravior Avatar asked Oct 23 '16 14:10

Ravior


1 Answers

Create your own renderer and override this method as follows:

public override bool DispatchTouchEvent(MotionEvent e)
{
    Parent.RequestDisallowInterceptTouchEvent(true);
    return base.DispatchTouchEvent(e);
}

Please find details in this link

like image 116
Ashi Avatar answered Sep 23 '22 15:09

Ashi