posted by Full-stack Developer 2011. 10. 25. 09:57
Step 1. Set WebviewClient
 

Webview child = new Webview(this);

...

child.setWebViewClient(new CWebViewClient(this));

Step 2. Using PageLoding Dialog

 public class CWebViewClient extends WebViewClient {
CWebviewLoding dlg;
Context ctx;
public CWebViewClient(Context ctx) {
this.ctx=ctx;
}

@Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }

@Override
public void onPageFinished(WebView view, String url) {
if(dlg!=null && dlg.isShowing()){
dlg.dismiss();
dlg=null;
}
super.onPageFinished(view, url);
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if(dlg==null){
dlg = new CWebviewLoding(ctx);
dlg.show();
}
super.onPageStarted(view, url, favicon);
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
if(dlg!=null && dlg.isShowing()){
dlg.dismiss();
dlg=null;
}
super.onReceivedError(view, errorCode, description, failingUrl);
}
}

Do u wanna  custom indeterminate progressbar?
 
here is  http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar

 

안녕하세요 ^^
설명을 조금 해보겠습니다. ㅎ
웹뷰에 페이지로딩할때 페이지로딩 시작,마침 시점에 다이얼로그를 삽입해
사용자에게 '아 먼가 돌아가고 있나보군!' 이라는 생각이 들게 만들려고 만든건데요

웹뷰에 setWebViewClient으로 Webviewclient를 세팅해주셔야해요.
그러려면 WebViewClient를 만들어야겠죠?

step2에서 보듯이 만드시면되요 잘보시면 dlg라고 커스텀한 다이얼로그가 있는데요
웹뷰 페이지로딩 시작과 종료시점에 show, dismiss를 해주시면 페이지가 로딩될때
잘 동작하겠죠 혹여나 error가 날때를 대비해서 에러나면 dismiss해주는것도 좋을듯
싶어요.

혹시 가운데 동글동글 돌아가는 다이얼로그가 필요하시나요?
아래 경로로가시면 커스텀한 다이얼로그 예제가 있답니닷!!
http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar

많은 도움이 되셨기를 빕니다.

즐코딩! 낫빡침!