Hello @vovanb ,
You could try to find the handle of this MAUI WebView, and get handler.PlatformView
, which is a native control of type Android.Webkit.WebView
. After that you can set native control properties, invoke native control methods, and subscribe to native control events and so on. For more details, you can refer to .NET MAUI control customization with handlers - .NET MAUI | Microsoft Learn
(There is an MyEntry
derived from Entry
in the sample, you can subclass the WebView
control)
Microsoft.Maui.Handlers.WebViewHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
#if ANDROID
if (view is MyCustomWebView)
{
Android.Webkit.WebView webView = handler.PlatformView;
webView.Settings.JavaScriptEnabled = true;
webView.Settings....
}
#endif
});
Best Regards,
Wenyan Zhang
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.