Code example for WebView: Displaying web pages

Methods: loadUrlsetInitialScale, getZoomControls

0
	        DisplayMetrics metrics = new DisplayMetrics();
	        getWindowManager().getDefaultDisplay().getMetrics(metrics);
	        //calculate display scale from screen size 
	        double screenW = metrics.widthPixels;
	        double scale = (screenW / 800) * 100; //width of image
	        myWebView.setInitialScale((int) scale); //it will fit on width of the screen
 
		    FrameLayout mContentView = (FrameLayout) getWindow().
		    getDecorView().findViewById(android.R.id.content);
		    final View zoom = this.myWebView.getZoomControls();
		    mContentView.addView(zoom, ZOOM_PARAMS);
		    zoom.setVisibility(View.GONE);
 
		    this.myWebView.loadUrl("file:///android_asset/floor_3_Printer.gif");
		  } 
		} 
Stop searching for code, let great code find you!  Add Codota to your java IDE