2016-11-18 91 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需要在加載之前計算它需要加載哪個頁面。我不確定,你應該檢查代碼。