小编Dug*_*gan的帖子

Xamarin Forms - 让 webview 返回

大家早,

我正在 Xamarin.Forms 中开发一个小的跨平台 webview 项目。我有 webview 工作,但我想添加一个工具栏,它有一个后退和前进按钮。

我尝试了许多不同的方法,但似乎没有什么特别有效。我尝试通过关注这些人发布导航工具栏来实现此功能

我将在下面附上我的代码,如果有人可以帮我解决这个问题或解决方案,那就太好了!

如果另一个用户之前已经回答了这个问题,那么我深表歉意。

应用程序

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Xamarin.Forms;

namespace DisplayWebPage
{
    public class App : Application
    {
        public App()
        {
            // The root page of your application
            MainPage = new WebPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when …
Run Code Online (Sandbox Code Playgroud)

c# android webview ios xamarin.forms

7
推荐指数
1
解决办法
1万
查看次数

Xamarin表单 - Webview没有显示出来

我正在开发一个小型的Xamarin.Forms webview应用程序.这是对之前回答的问题的后续问题,xamarin-forms-making-webview-go-back

所以我有一个工具栏和一个后退按钮实现和工作.但是当我运行程序时,模拟器已经打开(使用Genymotion),程序运行并显示工具栏和后退按钮......但不会显示webview.

但这是一件奇怪的事情,有时我在模拟器处于睡眠模式时运行程序,然后将程序切换回程序完美.此外,当我在iOS上测试它时,它只是显示工具栏而没有webview!更常见的是,模拟器不会显示webView.我也在我的Android设备上测试了这个,同样的事情发生了,它会显示工具栏但不显示webview.

Abit令人困惑我知道但是任何人都可以帮助我解决这个问题.

我将在下面附上我的代码:

App.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Xamarin.Forms;

namespace WebView_form
{
    public class App : Application
    {
        public App()
        {
            //const string URL = "http://www.google.com";
            MainPage = new NavigationPage(new WebPage());
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

WebPage.cs …

c# xamarin xamarin-studio xamarin.forms

7
推荐指数
1
解决办法
9620
查看次数

Xamarin表示webview不在设备上显示

我在过去几天在Xamarin.Forms中开发了一个webview应用程序,并且我已经在Android和iOS模拟器上进行了测试,它似乎在模拟器中运行得很好但是当我去尝试在我自己的Android设备上测试时,它只显示了xamarin splashscreen(我现在使用试用版)然后只是转换到空白的白色屏幕而不是webview.

有没有人有任何想法为什么这样做?

我将在下面附上我的代码: App.cs

using Xamarin.Forms;

namespace WebViewApp
{
    public class App() : Application
    {
        public App()
        {
            // The root page of your application
            MainPage = new WebPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

WebPage.cs

using Xamarin.Forms;

namespace WebViewApp
{
    public class WebPage : ContentPage …
Run Code Online (Sandbox Code Playgroud)

c# android webview ios xamarin

0
推荐指数
1
解决办法
7800
查看次数

标签 统计

c# ×3

android ×2

ios ×2

webview ×2

xamarin ×2

xamarin.forms ×2

xamarin-studio ×1