webview가 있습니다. 스크롤을 사용 중지했습니다. 그리고 그것은 안드로이드 전화 화면 크기의 너비와 동일합니다.Android webview 콘텐츠가 webview를 초과합니다
문제는 웹보기의 콘텐츠가 자동 크기 조정이 아니라 웹보기 외부에 표시된다는 것입니다 (스크롤을 사용 중지했지만 웹보기 크기가 화면 너비와 정확히 일치하지 않음).
이미
newsContent.getSettings().setUseWideViewPort(true);
newsContent.getSettings().setLoadWithOverviewMode(true);
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'>
및
을 추가하지만 여전히 작동하지. 감사.웹보기의 XML :
<WebView
android:id="@+id/newsContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:background="#ffffff" />
웹보기 JAVA :
StringBuilder sb = new StringBuilder();
sb.append("<HTML><HEAD><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'><LINK href=\"news.css\" type=\"text/css\" rel=\"stylesheet\"/><script src=\"jquery-1.10.2.js\" type=\"text/javascript\"></script></HEAD><body>");
sb.append(newsItem.description.toString());
sb.append("<script>$('img').on('click', function() {app.zoom($(this).attr('src'));});</script></body></HTML>");
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
newsContent.getSettings().setAllowUniversalAccessFromFileURLs(true);
newsContent.getSettings().setAllowFileAccessFromFileURLs(true);
}
newsContent.setWebChromeClient(new WebChromeClient());
newsContent.setWebViewClient(new WebViewClient());
newsContent.getSettings().setUseWideViewPort(true);
newsContent.getSettings().setLoadWithOverviewMode(true);
newsContent.getSettings().setJavaScriptEnabled(true);
newsContent.addJavascriptInterface(new WebViewJavaScriptInterface(), "app");
newsContent.loadDataWithBaseURL("file:///android_asset/", sb.toString(), "text/html", "utf-8", null);
newsContent.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});
newsContent.setVerticalScrollBarEnabled(false);
newsContent.setHorizontalScrollBarEnabled(false);
이 이
'웹뷰처럼 작동 테스트 알고 일부 사이트에 웹보기를 retargeitng 제안 .setLayerType (View.LAYER_TYPE_SOFTWARE, null); ' –
뷰가 너무 커서 도면 캐시에 적합하지 않습니다. ds 7890400 바이트, 3686400 만 사용 가능 – user782104
'webview.setDrawingCacheEnabled (false); –