Question

I would like to completely disable the fading edge at the top of my activity/application. My view consists of only a WebView that is created programmatically:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    webView = new WebView(this);
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.setVerticalFadingEdgeEnabled(false);
    webView.setFadingEdgeLength(0);

    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setSupportZoom(false);

    webView.loadUrl("...");
    setContentView(webView);
}

A fading edge is still visible at the top (between the WebView and the Android Status Bar), even though I've disabled the fading edge, and set the Length to 0. If I add some black space between the top of the WebView and the Android Status Bar, the fading edge is no longer visible.

So it seems like the fading edge is added by the activity itself, not the WebView. Any ideas why this is happening? Is there something I've missed, or some other way of removing the fading edge?

Similar: How to get rid of top fading edge in android full screen mode?

Was it helpful?

Solution

Here is what you want to do, it's a bit backwards to set the theme to fullscreen and then turn of the fullscreen flag, but it works :)

requestWindowFeature(Window.FEATURE_NO_TITLE);
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top