Code example for WebView: Displaying web pages

Methods: getSettingsloadUrlsetScrollBarStylesetWebViewClient, setOnTouchListener

0
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mWebView = (WebView) findViewById(R.id.webview);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.loadUrl("http://pixel5.co/golf");
        mWebView.setWebViewClient(new HelloWebViewClient());
        mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
     // disable scroll on touch 
        mWebView.setOnTouchListener(new View.OnTouchListener() {
 
          public boolean onTouch(View v, MotionEvent event) {
            return (event.getAction() == MotionEvent.ACTION_MOVE);
          } 
        }); 
    } 
     
    private class HelloWebViewClient extends WebViewClient {
        @Override 
Stop searching for code, let great code find you!  Add Codota to your java IDE