当前位置: 首页>>代码示例>>C#>>正文


C# WebView.LoadData方法代码示例

本文整理汇总了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);
          }
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:13,代码来源:TermsActivity.cs

示例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");
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:14,代码来源:PrintHtmlActivity.cs

示例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);

          }
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:15,代码来源:LicensureActivity.cs

示例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;
              };
        }
开发者ID:KiranKumarAlugonda,项目名称:PlanetXamarin,代码行数:21,代码来源:DetailActivity.cs

示例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);
 }
开发者ID:eatage,项目名称:AppTest,代码行数:12,代码来源:Web.cs


注:本文中的WebView.LoadData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。