1

I am trying to implement material design for my WebViewClient. The WebViewClient opens index.html saved in my asset. What I want to achieve is when the home page, index.html is opened, there shouldn't be a "up button". "Up button" should only be shown when I click on the link in index.html. I have tried

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

But apparently, this show "up button" for all of the pages. How to hide the "up button" for my homepage, index.html?

user2872856
  • 2,003
  • 2
  • 21
  • 54

1 Answers1

1

Problem solved by adding this under onPageFinished in my WebViewClient

public void onPageFinished(WebView view, String url) {

        if (url.equals("file:///android_asset/index.html")) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        } else {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        super.onPageFinished(view, url);
    }
user2872856
  • 2,003
  • 2
  • 21
  • 54