0
webservice에서 가져온 이미지를 웹보기에 표시하고 싶습니다.안드로이드 - webview의 이미지가 화면에 맞지 않습니다.
동영상에 성공하여 화면에 맞을 수 있습니다.
이것은 css 코드입니다.
<style type="text/css">
iframe {
display: block;
max-width:100%;
margin-top:10px;
margin-bottom:10px;
}
img {
display: block;
margin-top:10px;
margin-bottom:10px;
max-width:100%;
height:100%;
background-size: cover;
width: auto !important;
resize:both;
background:no-repeat fixed;
}
</style>
Google 검색을 기반으로하는 CSS 코드에서 많은 작업을 시도했지만 화면에 맞지 않았습니다.
다음이 CSS를 webview 콘텐츠에 추가합니다.
String str = "<style type=\"text/css\">\n" +
" iframe {\n" +
" display: block;\n" +
" max-width:100%;\n" +
" margin-top:10px;\n" +
" margin-bottom:10px;\n" +
" }\n" +
"\n" +
" img {\n" +
" display: block;\n" +
" margin-top:10px;\n" +
" margin-bottom:10px;\n" +
" max-width:100%;\n" +
" height:100%;\n" +
" background-size: cover;\n" +
" width: auto !important;\n" +
" resize:both;\n" +
" background:no-repeat fixed;\n" +
" }\n" +
"\n" +
"</style>"+currentNews.getContent();
그런 다음보기를로드합니다.
content.loadDataWithBaseURL("file:///android_asset/", str, "text/html", "utf-8", null);
난 스케일링되지 않은 양식이나 자른 버전 만 받았습니다. 미리 감사드립니다.
아직 어떤 아이디어가 있습니까? – Hilal