【发布时间】:2016-05-04 04:03:11
【问题描述】:
轻松一天,给你的朋友留下深刻印象!
来自 xlabs 的 Hybridwebview - https://github.com/XLabs/Xamarin-Forms-Labs/wiki/HybridWebView
正在尝试加载内容,如下所示。
在 android 上运行良好,在 ios 上使用 str 或 str2 都没有显示。
有什么想法吗?
CSHARP
void OnButtonStaticLoadClicked(object sender, EventArgs args)
{
// doesnt load on ios
string str = @"<html><body><h2>hello there</h2><div>four score and seven years ago </div></body></html>";
string str2 = @"<!DOCTYPE html>" +
@"<html>" +
@"<body bgcolor='yellow'><h2>hello there</h2><div style='font-color:black'>four score and seven years ago</div>" +
@"</body></html>";
HybridWebView_Main.LoadContent(str2);
}
XAML
<StackLayout>
<Button x:Name="Button_LoadStatic" Text="Load Static HTML" Clicked="OnButtonStaticLoadClicked" />
<controls:HybridWebView x:Name="HybridWebView_Main"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
BackgroundColor="Yellow"
HeightRequest="300" />
</StackLayout>
【问题讨论】:
标签: xamarin xamarin.forms