本章主要介绍书架内部书城的实现
书城分为
1. webview对应的activity为WebBrowser
书城分为
1. 中间的webview
2. 底部的gridview作为目录
3. menu键对应的弹出gridview目录。
1. webview对应的activity为WebBrowser
1. 设置页面缩放比例:this.b.setInitialScale(25)
2. 将java代码注册成为js: this.b.addJavascriptInterface(new JSDownLoad(this), "downloadbook");
3. 设置自己重写的WebViewClient重写5个重要方法
1. onLoadResource:设置底部菜单的展示
2. onPageFinished:设置loading=false,表示加载完成,关闭进度条
3. onPageStarted:设置loading=true,表示正在加载,展示进度条
4. onReceivedError:首次重试一次,如果仍然出错,重定向到"file:///android_asset/web/error.html"
5. shouldOverrideUrlLoading:无作用,自己可以在这里统一过滤url
4. 设置chrome客户端,重写onProgressChanged函数,用户限制进度条的进度
onProgressChanged(WebView webView, int progress){
mProgress.setProgress(progress)
}
5. onResume添加解决部分rom cmwap无法联网的bug
protected void onResume() {
super.onResume();
WebView.enablePlatformNotifications();
}