我有一个 Webview,它必须从 assets 文件夹中加载一个静态网页。该网页包含一个完美运行的javascript函数。问题是,当活动启动时,网页永远不会出现(而且经常出现。启动活动也包含 webview)
在 webview 确实加载时,您导航到另一个活动然后返回,此时 webview 不会重新绘制
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
actionBar.AddView(mainActionBar);
formDialog.AddView(LayoutInflater.Inflate(Resource.Layout.googleGraphInWebview, null));
formDialog.SetMinimumHeight(400);
graph = FindViewById<WebView>(Resource.Id.graphView);
list = FindViewById<ListView>(Resource.Id.AppointmentList); // get reference to the ListView in the layout
appointments.Add(new AppointmentListItem("Appointment: Appointment with Spur Cresta", "Remember to meet with Mike regarding the cost sales!", Resource.Drawable.Icon));
appointments.Add(new AppointmentListItem("Appointment: Jone's laundry needs to be collected", "Address: 12 Marry Street Roodepoort", Resource.Drawable.Icon));
list.Adapter = new AppointmentListViewAdapter(this, appointments);
list.ItemClick += AppointmentListClick; // to be defined
LinearLayout sideWidget = FindViewById<LinearLayout>(Resource.Id.SideWidget);
sideWidget = FindViewById<LinearLayout>(Resource.Id.SideWidget);
sideWidget.AddView(LayoutInflater.Inflate(Resource.Layout.LineItem, null));
graph.Settings.JavaScriptEnabled = true;
graph.SetWebViewClient(new webView(formDialog));
graph.LoadUrl("file:///android_asset/graph.html");
}
你能帮忙吗?
一个