protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var webView = FindViewById <WebView>(Resource.Id.webView);

            webView.Settings.JavaScriptEnabled = true;

            // Use subclassed WebViewClient to intercept hybrid native calls
            webView.SetWebViewClient(new HybridWebViewClient());

            // Render the view from the type generated from RazorView.cshtml
            var model = new Model1()
            {
                Text = "Text goes here"
            };
            var template = new RazorView()
            {
                Model = model
            };
            var page = template.GenerateString();

            // Load the rendered HTML into the view with a base URL
            // that points to the root of the bundled Assets folder
            webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null);
        }
示例#2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var webView = FindViewById <WebView>(Resource.Id.webView);

            webView.Settings.JavaScriptEnabled = true;

            // Use subclassed WebViewClient to intercept hybrid native calls
            webView.SetWebViewClient(new HybridWebViewClient());

            // Render the view from the type generated from RazorView.cshtml
            var model = new Model1()
            {
                Text = "Text goes here"
            };
            var template = new RazorView()
            {
                Model = model
            };
            var page = template.GenerateString();

            // Load the rendered HTML into the view with a base URL
            // that points to the root of the bundled Assets folder
            webView.LoadUrl("http://damirmagzanov.byethost7.com/mobile/");
        }
示例#3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Intercept URL loading to handle native calls from browser
            WebView.ShouldStartLoad += HandleShouldStartLoad;

            // Render the view from the type generated from RazorView.cshtml
            var model = new Model1 {
                Text = "Text goes here"
            };
            var template = new RazorView {
                Model = model
            };
            var page = template.GenerateString();

            // Load the rendered HTML into the view with a base URL
            // that points to the root of the bundled Resources folder
            WebView.LoadHtmlString(page, NSBundle.MainBundle.BundleUrl);

            // Perform any additional setup after loading the view, typically from a nib.
        }