【发布时间】:2014-08-18 05:29:49
【问题描述】:
我想将图像加载到 android WebView 并使其像 ImageView 的 android:scaleType="centerCrop"。
我试过http://css-tricks.com/perfect-full-page-background-image/。
所有在 PC 的 firefox 上都可以正常工作,但在 Android WebView 上却不行。它总是拉伸图像!即使我考虑到这个websetting.setLoadWithOverviewMode(false);,但没有任何改变。
只有 CSS3 方法几乎完成了。因为图像是背景而不是元素。但是,我遇到了 Using html/css3 and WebView to scale an image to the screen... get a white screen before the image loads 。解决方法也适用于 Firefox,但不适用于 android。
我别无选择,只能使用ImageView 吗?
【问题讨论】:
-
请张贴您要显示的一张图片的网址。
-
@valberos,真的,我不在乎图像是什么。我想知道如何调整
WebView的 html/设置以使图像全屏显示并表现得像centerCrop。 -
Android WebView 自 KitKat 以来基于 Chromium,或以下版本的 WebKit。请尝试通过 Chrome 或 Safari 使用 webkit。