如何自定义WebView在任何请求加入自定义请求头

2024-10-30 13:23:57
推荐回答(1个)
回答1:

方法参考如下:
private boolean mRestoringBookmark;
private float mScrollY;

@SuppressWarnings("deprecation")
protected void onPageFinished() {
if (mRestoringBookmark) {
setPictureListener(mPictureListener);
mRestoringBookmark = false;
}
}

@SuppressWarnings("deprecation")
private PictureListener mPictureListener = new PictureListener() {
@Override
public void onNewPicture(WebView view, Picture picture) {
// stop listening
setPictureListener(null);

scrollTo(0, (int)(getContentHeight() * mScrollY));
}
};
仅供参考。