Enable JavaScript and built-in zoom control of WebView

To enable JavaScript and built-in zoom control of WebView, we can call setJavaScriptEnabled(true) and setBuiltInZoomControls(true) functions of WebSettings class.



Enable JavaScript and built-in zoom control of WebView



Modify onCreate() method in last post More on WebView, override url loading.



    public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

webView = (WebView)findViewById(R.id.webview);

webView.getSettings().setJavaScriptEnabled(true);

webView.getSettings().setBuiltInZoomControls(true);

webView.setWebViewClient(new MyWebViewClient());

webView.loadUrl(DEFAULT_URL);



}






next post:

- Display Progress Bar on WebView when loading


0 Response to "Enable JavaScript and built-in zoom control of WebView"

Posting Komentar