2016-11-18 92 views
1

我有一个WebView和我使用WebView.goBack()时点击返回按钮,我在另一个地方使用WebView.goBackOrForward(x)。android WebView goBackOrForward()vs goBack()

我的问题是,为什么WebView.goBackOrForward(x)从互联网上再次加载访问过的网页,但WebView.goBack()不会再次加载访问过的网页并快速显示上一页网页?

回答

0

正如doc

goBack 
Added in API level 1 
void goBack() 
Goes back in the history of this WebView. 

代替

goBackOrForward 
Added in API level 1 
void goBackOrForward (int steps) 
Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward. 

我认为确切知道哪一页的WebView是要加载,使其更快与goBack它总是加载一个页面。 goBackOrForward需要在加载之前计算它需要加载哪个页面。我不确定,你应该检查代码。