本文整理汇总了C#中WebView.LoadData方法的典型用法代码示例。如果您正苦于以下问题:C# WebView.LoadData方法的具体用法?C# WebView.LoadData怎么用?C# WebView.LoadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebView
的用法示例。
在下文中一共展示了WebView.LoadData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
WebView view = new WebView(this);
string html;
using (var sr = new StreamReader(Assets.Open("TermsOfService.html")))
{
html = sr.ReadToEnd();
}
view.LoadData(html, "text/html", "UTF-8");
SetContentView(view);
}
示例2: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.PrintHtml);
webView = FindViewById <WebView> (Resource.Id.webView);
// Important: Only enable the print option after the page is loaded.
webView.SetWebViewClient (new MyWebViewClient (this));
// Load some HTML content
webView.LoadData ("<!DOCTYPE html><html><body><p>Hello world!</p><p><em>This is some html.</em></p><p>Click on the three dots in the top right to print.</p></body></html>",
"text/html",
"utf8");
}
示例3: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
WebView view = new WebView(this);
string html;
using (var sr = new StreamReader(Assets.Open("licensure.html")))
{
html = sr.ReadToEnd();
}
view.LoadData(html, "text/html", "UTF-8");
view.SetBackgroundColor(Color.Transparent);
SetContentView(view);
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Detail);
webView = FindViewById<WebView>(Resource.Id.webview);
var id = Intent.GetIntExtra("id", 0);
feedItem = MasterActivity.ViewModel.GetFeedItem(id);
webView.LoadData(feedItem.Description, "text/html", "charset=UTF-8");
webView.Settings.JavaScriptEnabled = true;
ActionBar.Title = feedItem.Title;
readFullButton = FindViewById<Button>(Resource.Id.button_read_full);
readFullButton.Click += (sender, args) =>
{
webView.LoadUrl(feedItem.Link);
readFullButton.Visibility = ViewStates.Gone;
};
}
示例5: OnReceivedError
/// <summary>
/// 访问出错
/// </summary>
/// <param name="view"></param>
/// <param name="errorCode"></param>
/// <param name="description"></param>
/// <param name="failingUrl"></param>
public override void OnReceivedError(WebView view, [GeneratedEnum] ClientError errorCode, string description, string failingUrl)
{
view.LoadData("<p></p><p><h4>无法访问服务器,请检查网络设置再重试;<br><p></p>如果确定网络通畅,请点击下方的刷新按钮</h4></p> <p><a href='" + failingUrl + "' style='text-decoration:none;'><strong>点击刷新</strong></a></p>", "text/html; charset=UTF-8", null);
base.OnReceivedError(view, errorCode, description, failingUrl);
}