admin管理员组

文章数量:1534201

自定义WebView,命名ProgressWebView,该ProgressWebView的一个特点,加载网页地址的时候,动态显示加载进度,和普通浏览器差不多,代码如下:

public ProgressWebView(Context context, AttributeSet attrs) {

super(context, attrs);

progressbar = new ProgressBar(context, null,android.R.attr.progressBarStyleHorizontal);

progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,10, 0, 0));

Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);

progressbar.setProgressDrawable(drawable);

addView(progressbar);

setWebViewClient(new WebViewClient(){});

setWebChromeClient(new WebChromeClient());

//是否支持缩放

getSettings().setSupportZoom(true);

getSettings().setBuiltInZoomControls(true);

}

本文标签: 浏览器简单简易快速地址