点42-导航到资产文件夹中的HTML



我正在尝试使用DOT42在C#中进行编码。如何导航到Assets文件夹中的html。我用以下代码在java中实现了与Eclipse相同的功能:

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String url = "http://www.google.com";
    url="file:///android_asset/out/in/active_deals.html";        
    WebView webv = (WebView) findViewById(R.id.webview1);
    WebSettings settings = webv.getSettings();
    settings.setJavaScriptEnabled(true);
    webv.setWebViewClient(new WebViewClient());
    webv.loadUrl(url);
}

当我尝试用DOT42在C#中做同样的事情时,它说找不到页面:

protected override void OnCreate(Bundle savedInstance)
    {
        base.OnCreate(savedInstance);
        SetContentView(R.Layouts.MainLayout);
        base.OnCreate(savedInstance);
        SetContentView(R.Layouts.MainLayout);
        string url = "";
        //url = "http://www.google.com";
        url = "file:///Android_Asset/out/in/active_deals.html";
        WebView myWebView = (WebView)FindViewById(R.Ids.webview1);
        myWebView.SetWebViewClient(new WebViewClient());
        myWebView.LoadUrl(url);
        WebSettings webSettings = myWebView.GetSettings();
        webSettings.SetJavaScriptEnabled(true);
    }

我尝试过用小写和大写命名资产文件夹,但似乎都不起作用。我试过"Android_Asset"、"droid_Asset"one_answers"Asset",但都不起作用。不过,它适用于eclipse。

当您将嵌入式资源添加到Visual Studio项目中时,它将转换为APK中具有完整名称空间名称的资产。

例如,以以下URL为例:

var url = "file:///android_asset/dot42AssetWebView.Resources.Index.htm";

它适用于命名空间"dot42AssertWebView.Resources".

中名为Index.htm的嵌入式资源

最新更新