Android webview provides us with many convenient interfaces and methods. It is also so convenient when using its zoom-in and zoom-out functions, however, when using the webview control, it is easy to form an operational conflict with the content in the webview control. In the end, you can use the online data search function to zoom in and out. The two steps are as follows:
// Hide the public void setzoomcontrolgone (view) {class classtype; field; try {classtype = webview. class; field = classtype. getdeclaredfield ("mzoombuttonscontroller"); field. setaccessible (true); zoombuttonscontroller mzoombuttonscontroller = new zoombuttonscontroller (View); mzoombuttonscontroller. getzoomcontrols (). setvisibility (view. gone); try {field. set (view, mzoombuttonscontroller);} catch (illegalargumentexception e) {e. printstacktrace ();} catch (illegalaccessexception e) {e. printstacktrace () ;}} catch (securityexception e) {e. printstacktrace ();} catch (nosuchfieldexception e) {e. printstacktrace ();}}
Call:
webView = (WebView) findViewById(R.id.webView);webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);WebSettings webSettings =webView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(true); setZoomControlGone(webView);
The above method can be used to achieve