如何在 Zebble for Xamarin 中使用 Web 视图在移动设备中显示网页?
How can I show a web page in a mobile device with web view in Zebble for Xamarin?
我已尝试按照此处的文档操作:
http://zebble.net/docs/webview-class-displaying-html
我制作了一个网页并尝试从本地文件夹在设备中显示它,为此我从 Zebble.net 网站找到了一个示例代码来在设备中显示网页。
我尝试用下面的代码显示页面。
<WebView Url="Resources/index.html" />
但是,它显示此错误:找不到文件:/Resources/index.html
然后我将其更改为下面的代码,但还是没有用。
<WebView Url="/Resources/index.html" ></WebView>
要在 Zebble 的 WebView 中显示本地 html 文件,您不需要在 URL 中写入 "resources"。虽然该文件位于 Resources 文件夹中,但您应该隐含地忽略该部分。
见http://zebble.net/docs/accessing-files-and-folders
以下代码将在您的 App.UI\Resources 文件夹中显示名为 index.html 的 HTML 文件:
<WebView Url="/index.html">
这是用于测试它的完整 Zebble 页面的代码:
<z-Component z-type="MyPage" z-base="Templates.Default"
z-namespace="UI.Pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./../.zebble-schema.xml">
<WebView Url="/index.html" />
</z-Component>
我已尝试按照此处的文档操作:
http://zebble.net/docs/webview-class-displaying-html
我制作了一个网页并尝试从本地文件夹在设备中显示它,为此我从 Zebble.net 网站找到了一个示例代码来在设备中显示网页。 我尝试用下面的代码显示页面。
<WebView Url="Resources/index.html" />
但是,它显示此错误:找不到文件:/Resources/index.html
然后我将其更改为下面的代码,但还是没有用。
<WebView Url="/Resources/index.html" ></WebView>
要在 Zebble 的 WebView 中显示本地 html 文件,您不需要在 URL 中写入 "resources"。虽然该文件位于 Resources 文件夹中,但您应该隐含地忽略该部分。
见http://zebble.net/docs/accessing-files-and-folders
以下代码将在您的 App.UI\Resources 文件夹中显示名为 index.html 的 HTML 文件:
<WebView Url="/index.html">
这是用于测试它的完整 Zebble 页面的代码:
<z-Component z-type="MyPage" z-base="Templates.Default"
z-namespace="UI.Pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./../.zebble-schema.xml">
<WebView Url="/index.html" />
</z-Component>