C# 无法在android设备上使用Xamarin在webview中下载

C# 无法在android设备上使用Xamarin在webview中下载,c#,android,html,xamarin,C#,Android,Html,Xamarin,我正试图用Xamarin在webview中下载和上传,当我点击上传按钮时。。。什么也没发生。应该在什么时候下载。什么也没发生 如何更改此代码以允许我这样做 using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Android.Webkit; namespace

我正试图用Xamarin在webview中下载和上传,当我点击上传按钮时。。。什么也没发生。应该在什么时候下载。什么也没发生

如何更改此代码以允许我这样做

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Webkit;

namespace Test
{
    [Activity(Label = "E-Special", MainLauncher = true, Theme = "@android:style/Theme.NoTitleBar")]

    public class MainActivity : Activity
    {

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

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

            web_view = FindViewById<WebView>(Resource.Id.webview);
            web_view.Settings.JavaScriptEnabled = true;
            web_view.LoadUrl("http://test.123.com/testingtster");
            web_view.SetWebViewClient(new HelloWebViewClient());
        }

        public class HelloWebViewClient : WebViewClient
        {
            public override bool ShouldOverrideUrlLoading(WebView view, string url)
            {
                view.LoadUrl(url);
                return true;
            }
        }

        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            if (keyCode == Keycode.Back && web_view.CanGoBack())
            {
                web_view.GoBack();
                return true;
            }

            return base.OnKeyDown(keyCode, e);
        }
    }
}
使用系统;
使用Android.App;
使用Android.Content;
使用Android.Runtime;
使用Android.Views;
使用Android.Widget;
使用Android.OS;
使用Android.Webkit;
名称空间测试
{
[活动(Label=“E-Special”,MainLauncher=true,Theme=“@android:style/Theme.NoTitleBar”)]
公共课活动:活动
{
私有网络视图网络视图;
创建时受保护的覆盖无效(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
web_view=findviewbyd(Resource.Id.webview);
web_view.Settings.JavaScriptEnabled=true;
web_view.LoadUrl(“http://test.123.com/testingtster");
SetWebViewClient(新的HelloWebViewClient());
}
公共类HelloWebViewClient:WebViewClient
{
公共重写bool ShouldOverrideUrlLoading(WebView视图,字符串url)
{
view.LoadUrl(url);
返回true;
}
}
公共覆盖bool OnKeyDown(Android.Views.Keycode-Keycode,Android.Views.KeyEvent e)
{
if(keyCode==keyCode.Back&&web\u view.CanGoBack())
{
web_view.GoBack();
返回true;
}
返回base.OnKeyDown(keyCode,e);
}
}
}
注意**url不是正确的url。把它放在论坛上就行了


此外,上传是通过一个简单的html上传表单完成的。下载是通过php来设置下载的。所有这些在我的电脑上都能正常工作。。但是,当我使用android设备时,我无法下载或上传错误的方法顺序:

  • 首先
    web_view.SetWebViewClient(新的HelloWebViewClient())

  • 然后
    web\u view.LoadUrl(“http://test.123.com/testingtster");


现在,在设置WebViewClient之前调用LoadUrl

有人吗?真的需要帮助。你解决了吗?它可以加载到我的网络视图中。只是不会下载或上传。你能提供更多细节吗?什么是下载/上传?