Android examples for User Interface:WebView Zoom
set WebView Display Zoom Control
//package com.java2s; import java.lang.reflect.InvocationTargetException; import android.annotation.TargetApi; import android.os.Build; import android.view.View; import android.webkit.WebView; import android.widget.ZoomButtonsController; public class Main { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void setDisplayZoomControl(WebView mWebview, boolean flg) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { // Use the API 11+ calls to disable the controls mWebview.getSettings().setDisplayZoomControls(flg); } else {//from w ww. j a v a 2s. c om ZoomButtonsController zoom_controll; try { zoom_controll = (ZoomButtonsController) mWebview.getClass() .getMethod("getZoomButtonsController") .invoke(mWebview, null); if (zoom_controll != null) { if (flg) { zoom_controll.getContainer().setVisibility( View.VISIBLE); } else { zoom_controll.getContainer().setVisibility( View.GONE); } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } }