小编Kaz*_*ndo的帖子

WebView Back,Refresh,Forward?根本行不通!

我已经尝试了一切让我的"前进"和"后退"工作.

刷新工作[我通过将方法更改为'webView.reload();'来解决这个问题.而不是'webView.refresh();'

任何人都可以协助前进和后退吗?我试过'前锋','canGoForward'和'goForward'以及'后退','canGoBack'和'goBack'.没有错误代码,但这些方法实际上都没有做任何事情.

public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu); // Add menu items, second value is the id, use this in the onCreateOptionsMenu
    menu.add(0, 1, 0, "Back");
    menu.add(0, 2, 0, "Refresh");
    menu.add(0, 3, 0, "Forward");
    return true; // End of menu configuration
}
public boolean onOptionsItemSelected(MenuItem item){ // Called when you tap a menu item
    switch (item.getItemId()){
        case 1: //If the ID equals 1, go back
            webView.goBack();
        return true;
        case 2 : //If the ID equals 2, refresh
            webView.reload();
        return …
Run Code Online (Sandbox Code Playgroud)

user-interface android webview android-layout options-menu

6
推荐指数
1
解决办法
8968
查看次数