android控件之WebView控件缩小
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 {
//50766649
private string urlhelp = "//www.jb51.net",
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 asynctask<string, 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);
}
}
}
推荐阅读
-
Android编程布局控件之AbsoluteLayout用法实例分析
-
C#之WinForm跨线程访问控件实例
-
WPF自定义控件和样式之自定义按钮(Button)
-
Android APP之WebView校验SSL证书的方法
-
Android计时器控件Chronometer应用实例
-
在ASP.NET 2.0中操作数据之十二:在GridView控件中使用TemplateField
-
在ASP.NET 2.0中操作数据之十三:在DetailsView控件中使用TemplateField
-
Android UI控件Switch的使用方法
-
Android控件AppWidgetProvider使用方法详解
-
深入分析C#中WinForm控件之Dock顺序调整的详解