我一直在嘗試在使用monodroid的應用程序使用的WebView
中顯示進度條實現。我已經達到很遠,但似乎無法解決這個難題的最後部分。我正在使用Monodroid Pro的付費版本,並使用Galaxy S2作爲測試設備。如何在MonoDroid上的WebView中顯示進度條
這是我迄今所做的: -
在OnCreate
科: -
Window.RequestFeature(WindowFeatures.Progress);
SetContentView(Resource.Layout.Main);
Window.SetFeatureInt(WindowFeatures.Progress, Window.ProgressVisibilityOn);
wv.SetWebViewClient(new monitor());
wv.LoadUrl("https://www.google.com");
現在在onprogress改變重寫方法: -
private class progress : WebChromeClient
{
public override void OnProgressChanged(WebView view, int newProgress)
{
base.OnProgressChanged(view, newProgress);
}
}
現在的解決方案我見過的是用於Android的java實現,這很容易,即: -
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
//Make the bar disappear after URL is loaded, and changes string to Loading...
MyActivity.setTitle("Loading...");
MyActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
//Return the app name after finish loading
if(progress == 100)
MyActivity.setTitle(R.string.app_name);
}
});
但是用MonoDroid的我不能使用SetProgress
方法如在Android實現中,Activity
實例可以在OnCreate
方法進行,而在MonoDroid的一個全新的類將被進行,然後webchromeclient
要被第一繼承然後等等。我錯過了什麼?還有另一種我不知道的方式嗎?一些幫助將非常感激。
非常感謝您的詳細幫助!!,這真的很有幫助!您提供的指南鏈接也將非常有幫助。在此之後,我將專注於意圖,即接收來自瀏覽器的鏈接,發送給另一個活動等。已經完成了意圖過濾器事件,處理部分仍然存在。再次,非常感謝! – wjbjnr