图老师小编精心整理的android控件之WebView控件缩小希望大家喜欢,觉得好的亲们记得收藏起来哦!您的支持就是小编更新的动力~
【 tulaoshi.com - 编程语言 】
代码如下:
package com.weizhu.lan.view;
import com.weizhu.lan.util.MyprogressDialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
public class HelpCenter extends Activity {
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/) //50766649
private String urlHelp = "http://www.tulaoshi.com",
userid = "userid=";
private String yqhId;
private WebView web;
private Handler hand;
private ProgressBar pb;
private MyAsyncTask myAsy;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.help_webview);
yqhId = getIntent().getStringExtra("yqhId");
web = (WebView) findViewById(R.id.help_WebView1);
web.getSettings().setBuiltInZoomControls(true); //可放大、缩小
myAsy = new MyAsyncTask();
final String str = urlHelp;
myAsy.execute(str);
}
class MyAsyncTask extends AsyncTaskString, String, Void{
@Override
protected Void doInBackground(String... params) {
web.loadUrl(params[0]);
web.setWebChromeClient(new WebChromeClient(){
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
pb.setProgress(newProgress); //它自己会处置进度条
}
});
return null;
}
@Override
protected void onPostExecute(Void result) {
}
@Override
protected void onPreExecute() {
pb = (ProgressBar) findViewById(R.id.help_progressBar2);
pb.setProgress(0);
}
}
}
来源:http://www.tulaoshi.com/n/20160219/1592294.html
看过《android控件之WebView控件缩小》的人还看了以下文章 更多>>