c# - Xamarin - 文件:///android_asset
问题描述
我的应用程序的作用:加载index.html
到 WebView
index.html's Code:
<html>
<body>
<a href="Posts10.html"><h2>Interesting Stuff</h2></a>
</body>
</html>
所以每当我点击链接时,它都会给我这个错误:
index.html
并且Posts10.html
位于
Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"/CachedPosts"
又名
"/data/user/0/com.companyname.theoctant/files/CachedPosts"
解决方案
这可能会有所帮助。来自 Xamarin 文档:
在 Android 上,使用构建操作 AndroidAsset 将 HTML、CSS 和图像放在 Assets 文件夹中,如下所示:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=vswin#android
推荐阅读
- reactjs - 无法使用 React 在 App.js 中呈现子组件
- r - 如何在 R 中找到 R^d 上的函数的水平集?
- angular - 角度搜索过滤器(由字符串数组组成)
- java - 我是否必须保持导航图中的片段 ID 与菜单项 ID 相同?
- typescript - AWS CDK - 不能在构造 ID 中使用令牌 - 如何根据其他构造的名称动态命名构造?
- c# - TFS 自动关联 ID 未提供的其他工作项
- android - Android Studio 使用 gradle 同步构建配置问题
- sql - 如何计算两个表之间的指标
- mysql - MySQL从许多表中返回唯一组合
- electron - Electron 应用程序在 Windows 10 中运行良好,但在 Windows 7 中显示白屏