Levent Tulun
Levent Tulun

Reputation: 711

Remove White Space in WebView

i am using webview on my responsive theme. everypages work well without signin page. i checked in chrome and all browsers, it seems full screen but in webview, white blank occure.

How can i fix this ? Here is my real url (u can check) : http://104.196.41.207/PathologyCloud/signin.php

And my webview code :

package tscolari.mobile_sample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class AndroidMobileAppSampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main);

        WebView mainWebView = (WebView) findViewById(R.id.mainWebView);

        WebSettings webSettings = mainWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        mainWebView.setWebViewClient(new MyCustomWebViewClient());
        mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

        mainWebView.loadUrl("http://104.196.41.207/PathologyCloud/signin.php");
    }

    private class MyCustomWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}

and main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/mainWebView">
     </WebView>

</LinearLayout>

EDIT : HOW LOOK LIKE IN WEBVIEW :

enter image description here

Upvotes: 0

Views: 3309

Answers (1)

tiny sunlight
tiny sunlight

Reputation: 6251

I think it's scrollBar;

<WebView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    android:id="@+id/mainWebView">
</WebView>

mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

to

mainWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);

Upvotes: 2

Related Questions