如何在加载 WebView 之前显示布局的进度条
我正在将 WebView 加载到 LinearLayout,并希望在此布局中显示 ProgressBar,直到 WebView 完全加载。我通过以下链接进行访问,它们似乎非常棒,但我不想使用 ProgressDialog,相反,我想在布局内使用进度条。
http://xjaphx.wordpress.com/2011/07 /31/load-webview-with-progressdialog/
我该怎么做?
例如,
if(pos==0)
{
mLayout.setVisibility(View.VISIBLE);
mWeb.loadUrl("http://android.stackexchange.com/");
}
在 mLayout
内,我想显示一个进度条,直到显示页面。
I am loading a WebView to the LinearLayout and want to display a ProgressBar inside this layout until the WebView is fully loaded.I wnet through the below links and they seems to be really great but I do not want to use ProgressDialog, instead I would like to use progressbar inside the layout.
http://xjaphx.wordpress.com/2011/07/31/load-webview-with-progressdialog/
how to show progress bar on webview?
How would I do that?
Say for example,
if(pos==0)
{
mLayout.setVisibility(View.VISIBLE);
mWeb.loadUrl("http://android.stackexchange.com/");
}
Inside mLayout
I would like to display a progressbar until the page gets displayed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要在 webview 中定义进度条:
1. 在布局中定义
ProgressBar
和Webview
,如下所示:2. Inside您的活动:
To define progress bar inside webview:
1. Define
ProgressBar
andWebview
inside your layout like this:2. Inside your activity:
您可以像这样简单地使用 webView setPictureListener() :
You can simply use the webView setPictureListener() like this:
我确信这是检测页面加载完成的更好方法。
I am sure this is a better way ti detect that a page loading is finished.