您的位置:首页 > 移动开发 > Android开发

Android开发WebView与JS源码交互讲解

2019-01-10 17:01 155 查看

 private WebView webView;
 private String htmlStr = "";  //源代码语言
 
  //设置相关属性
  webView.loadDataWithBaseURL(null, "<style> img{max-width:80%;height:auto;} </style>"+htmlStr, "text/html", "utf-8", null);

                    WebSettings settings = webView.getSettings();

                    settings.setUseWideViewPort(true);// 这个很关键

                    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);

                    settings.setUseWideViewPort(true);

                    settings.setSupportZoom(true);

                    settings.setTextSize(WebSettings.TextSize.NORMAL);

                    settings.setDefaultFontSize(17);

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: