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

Xamarin Forms WebView and Gesture Recogniser issues with Android

$
0
0

Hello all,
I have developed an app with WebView to display local HTML content. I have also added Swipe GestureRecognizers to the WebView to update the source binding content to load new HTML files when user swipes right or left. The Xaml code for this is shown below:

    <WebView
        x:Name="HtmlView"
        Grid.Row="1" 
        Source="{Binding HTMLFile}" 
        HorizontalOptions="FillAndExpand" 
        VerticalOptions="FillAndExpand"
        GoBackRequested="Handle_GoBackRequested"
        GoForwardRequested="Handle_GoForwardRequested"
        >
        <WebView.GestureRecognizers>
        <SwipeGestureRecognizer Direction="Left" Swiped="Handle_SwipedLeft"/>
        <SwipeGestureRecognizer Direction="Right" Swiped="Handle_SwipedRight"/>
        </WebView.GestureRecognizers>
    </WebView>

and the gesture recognisers:

    void Handle_GoForwardRequested(object sender, System.EventArgs e)
    {
        flashCard.HTMLFile = getHTMLFileFromDevice("FlashCard2.html");
        HtmlView.Reload();
    }

    void Handle_GoBackRequested(object sender, System.EventArgs e)
    {
        flashCard.HTMLFile = getHTMLFileFromDevice("FlashCard3.html");
        HtmlView.Reload();
    }

This works completely fine with iOS, but when I launch it on android (emulator) the gesture handlers dont get triggered at all. Is there an issue with android and gesture recognisers?

Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>