1. 程式人生 > >Xamarin使用筆記之WebView

Xamarin使用筆記之WebView

alert eval cti .html ges mage strong 事件 eva

一、事件調用

1.Xamarin調用webview事件:

WebView展示的代碼如下:

var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html>
                <head>
                    <meta charset=‘UTF-8‘>
                    <title></title>
                    <script>
                        function showMsg(msg){
                            alert(‘hello ‘+msg);
                        }
                    </script>
                </head>
                <body>
                    你好世界.
                </body>
                </html>
"; this.webview.Source = htmlSource;

調用核心代碼:

this.wv.Eval("showMsg(‘王磊‘)");

效果如下:

技術分享

2.webview調用Xamarin事件:

//todo

Xamarin使用筆記之WebView