LOUNGE all new asksnapzu ideasforsnapzu newtribes interesting pics videos funny technology science technews gaming health history worldnews business web research entertainment food living internet socialmedia mobile space sports photography nature animals movies culture travel television finance music celebrities gadgets environment usa crime politics law money justice psychology security cars wtf art google books lifetips bigbrother women apple kids recipes whoa military privacy education facebook medicine computing wildlife design war drugs middleeast diet toplists economy fail violence humor africa microsoft parenting dogs canada neuroscience architecture religion advertising infographics sex journalism disaster software aviation relationships energy booze life japan ukraine newmovies nsa cannabis name Name of the tribe humanrights nasa cute weather gifs discoveries cops futurism football earth dataviz pets guns entrepreneurship fitness android extremeweather fashion insects india northamerica

Can anyone give me a hand with Android's WebView?

I'm trying to hide the top banner of a webpage in an Android WebView, but it's doing my head in! I've been at it for days and still can't get it to work.

I have used the code below, to try to disable the displaying of a certain element, the page loads (including the element I don't want) but then disappears completely and shows the word "none".

private class MyWebViewClient extends WebViewClient {

    public boolean shouldOverrideUrlLoading(WebView webView, String url) {
        return true;

    public void onPageFinished(WebView webView, String url) {


This is the onCreate

protected void onCreate(Bundle savedInstanceState) {

    AdView mAdView;
    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();

    this.webView = (WebView) findViewById(R.id.webview);

    WebSettings webSettings = webView.getSettings();

    // To keep browser in width of phone

    // Sets default zoom


    MyWebViewClient webViewClient = new MyWebViewClient();


Any class I choose (not just welcome) hides the entire website and displays the word 'none'. And if I change it to try to change height to 0px, it displays '0px' to the screen.

It's not a problem with the specific website I'm using, it does the same for my personal simple HTML / CSS website. Which makes me think either my JavaScript is wrong or there's something in WebView stopping me.

3 years ago by internethermit

Join the Discussion

  • Auto Tier
  • All
  • 1
  • 2
  • 3
Post Comment