android - Browser's webpage able to zoom in and zoom out -


i developing android application requires open url link in web browser zoom in , zoom out control (i.e, chrome)
zoom in , zoom out facility found 1 solution want set zoom in , zoom out functionality programmatically.

i not want use android webview load webpages.

try {         intent myintent = new intent(intent.action_view, uri.parse("https://www.mds-foundation.org/mdsmanager/help"));         startactivity(myintent); } catch (activitynotfoundexception e) {        toast.maketext(mainactivity.this, "no application can handle request. please install web browser",  toast.length_long).show();        e.printstacktrace(); } 

you cannot set zoom level while using intent intent.action_view. solution referring handling zoom level inside app only. not possible firing intent.

if want use android webview can this

public class mybrowser extends activity {     @override    public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_layout);      string loadurl = "https://stackoverflow.com/";     int scale = 60; //scale percent of zoom level want      webview webview = (webview) findviewbyid(r.id.webview);      webview.getsettings().setloadwithoverviewmode(true);     webview.getsettings().setusewideviewport(true);     webview.setinitialscale(scale);      try {         webview.loadurl(loadurl);     } catch (exception e) {         e.printstacktrace();     }   } } 

in layout file can define webview

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">      <webview     android:id="@+id/webview"     android:layout_width="match_parent"     android:layout_height="match_parent"></webview>  </linearlayout> 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -