onReceivedError方法:在方法中进行判断处理,比如说load错误页面
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getSettings().setLoadWithOverviewMode(true;
//html里多宽(一行的文字多长)webview就多宽,就是说要展示满满的一行文字
setLoadWithOverviewMode(true) loads the WebView completely zoomed out
//自动换行,手机多宽,webview就多宽
setUseWideViewPort(true) makes the Webview have a normal viewport (such as a normal desktop browser), while when false the webview will have a viewport constrained to its own dimensions (so if the webview is 50px*50px the viewport will be the same size)
两个一起用,webview里一行展示不出来,那就需要suoxiao
js和java代码的互相调用:
https://juejin.im/entry/57b586d35bbb50006303c7e7
http://www.jianshu.com/p/55512b523178
http://www.jianshu.com/p/415af04b5891
调用支付宝支付时的问题:
if (url.startsWith("http:") || url.startsWith("https:")) {
view.loadUrl(url);
//在当前的webview中跳转到新的url
return true;
} else {
mOtherJump = true;
}
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
} catch (Exception e) {
return true;
}
上传图片:http://blog.youkuaiyun.com/worst_hacker/article/details/62416755
和SwipeRefreshLayout结合使用的问题:
http://blog.youkuaiyun.com/worst_hacker/article/details/62226183
关于在浏览器中使用scheme方式打开app
<activity android:name=".ui.GuideActivity">
<intent-filter>
<data
android:host="com.yxjy.baonaer"
android:scheme="baonaer" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<a href="baonaer://com.yxjy.baonaer">跳转app</a>
Android M中新添加的app-links
http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0718/3200.html
webview播放audio问题:
http://stackoverflow.com/questions/15946183/android-webview-html5-video-autoplay-not-working-on-android-4-0-3