MAUI application WebView control is not scrolling in Android using touch.

Jerry Bonetti 0 Reputation points
2025-03-27T23:24:13.84+00:00

Need help on my MAUI application that includes a WebView control which I load with an in memory html string.

When app runs on Android, scrolling cannot be done with touch. Scrolling does work with arrow keys.

The app does scroll by touch in iOS.

Developer technologies .NET .NET MAUI
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2025-03-28T02:18:23.7933333+00:00

    Hello,

    This is an expected behavior. Android's native WebView control does not have the ability to scroll independently. You need to wrap the WebView with a ScrollView or Grid to solve this problem.

    Please refer to the following code sample:

    
    <ScrollView>
    
        <VerticalStackLayout>
    
            <WebView>
    
                ...
    
            </WebView>
    
        </VerticalStackLayout>
    
    </ScrollView>
    
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Jerry Bonetti 0 Reputation points
    2025-03-28T11:14:33.31+00:00

    I just found out why I'm having this issue. I hope this helps someone...I ended up separating the code into a simple content page to test this out. What I added a few weeks ago, when I implemented the webview, is a hard coded widthrequest and heightrequest on the webview because it was not visible on iOS but was on Android. When I removed this just now it now works properly on Android. But now it does not show on iOS because the height is too small by default. So I added a an #if IOS entry in the code to only do the heightrequest for IOS and now it works in both.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.