方法参考如下:
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));
}
};
仅供参考。