我在WebView
中加载a .jpg
。我的问题是,我发现这个:Android WebView, Scaling Image to fit the screenAndroid中的Webview图像适合屏幕
它不适合我。
这里是我的代码:
Display display = getWindowManager().getDefaultDisplay();
int width= display.getWidth();
Toast.makeText(getApplicationContext(), ""+width, Toast.LENGTH_LONG).show();
String html = "<html><head><title>Example</title><meta name=\"viewport\"\"content=\"width="+width+", initial-scale=0.65 \" /></head>";
html+= "<body><img width=\""+width+"\"<img src=\""+"image.jpg"+"\" /></body></html>";
aboutText.loadDataWithBaseURL("file:///android_res/drawable/", html, "text/html","UTF-8" , null);
你试过我的回答吗? –
这是正确的解决方案:http://stackoverflow.com/a/23656581/550393 – 2cupsOfTech