原
WebView web;String url;web.getSettings().setUseWideViewPort(true);web.getSettings().setLoadWithOverviewMode(true);web.getSettings().setDisplayZoomControls(false);web.setVerticalScrollBarEnabled(false);web.setHorizontalScrollBarEnabled(false);web.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);String data = " ";web.loadUrl(url);web.loadDataWithBaseURL("",data,"text/html", "UTF-8", "");
后
WebView web;String url;web.setVerticalScrollBarEnabled(false);web.setHorizontalScrollBarEnabled(false);web.getSettings().setJavaScriptEnabled(true);web.getSettings().setUseWideViewPort(true);web.getSettings().setLoadWithOverviewMode(true);String data = " ";web.loadUrl(url);web.loadDataWithBaseURL("",data,"text/html", "UTF-8", "");
后 参考
ImageView img;String url = "url_example";new AsyncTask(){ protected Bitmap doInBackground(String... params) { HttpURLConnection httpURLConnection = null; try{ httpURLConnection = (HttpURLConnection) new URL(url).openConnection(); final InputStream is = httpURLConnection.getInputStream(); return BitmapFactory.decodeStream(is, null, new BitmapFactory.Options()); } catch(Exception e) { e.printStackTrace(); } finally { httpURLConnection.disconnect(); } return null; } protected void onPostExecute(Bitmap bitmap) { img.setImageBitmap(bitmap); }}.execute(grav);