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

2025-01-01 12:52:00
推荐回答(1个)
回答1:

如何自定义WebView在任何请求加入自定义请求头
你好,方法参考如下:
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));
}
};