Created
November 25, 2015 00:16
-
-
Save Kimserey/e0b0a8e415681dd6f979 to your computer and use it in GitHub Desktop.
WebView for Xamarin Android in F#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <WebView | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:id="@+id/webview" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace App2 | |
| open System | |
| open Android.App | |
| open Android.Content | |
| open Android.OS | |
| open Android.Runtime | |
| open Android.Views | |
| open Android.Widget | |
| open Android.Webkit | |
| [<Activity (Label = "App2", MainLauncher = true)>] | |
| type MainActivity () = | |
| inherit Activity () | |
| let mutable webView: WebView = null | |
| override this.OnCreate (bundle) = | |
| base.OnCreate (bundle) | |
| // Set our view from the "main" layout resource | |
| this.SetContentView (Resource_Layout.Main) | |
| webView <- this.FindViewById<WebView>(Resource_Id.webview) | |
| webView.SetWebChromeClient(new WebChromeClient()); | |
| webView.Settings.JavaScriptEnabled <- true | |
| webView.Settings.DomStorageEnabled <- true | |
| webView.Settings.AllowFileAccess <- true | |
| webView.Settings.AllowFileAccessFromFileURLs <- true | |
| webView.Settings.AllowUniversalAccessFromFileURLs <- true | |
| webView.Settings.JavaScriptEnabled <- true | |
| webView.Settings.SaveFormData <- false | |
| webView.LoadUrl "file:///android_asset/index.html" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment