lo que funcionó para mí fue la siguiente: He leído que con el fin de ajustarse al ancho de la pantalla se debe añadir esto a su HTML o XML dentro del campo:
width="100%"
Así que lo que hice fue, en vez de escalar y hacer zoom en las imágenes, obtuve el xml, lo puse en un StringBuilder, encontré el src = "https://blablabla.com/image.png" que está dentro del campo y justo antes del '' subcadena insertar el 'src width =' 100% '', entonces y configurar mi web View con el StringBuilder, código de mi es la siguiente:
public void setWebViewWithImageFit(String content){
// content is the content of the HTML or XML.
String stringToAdd = "width=\"100%\" ";
// Create a StringBuilder to insert string in the middle of content.
StringBuilder sb = new StringBuilder(content);
int i = 0;
int cont = 0;
// Check for the "src" substring, if it exists, take the index where
// it appears and insert the stringToAdd there, then increment a counter
// because the string gets altered and you should sum the length of the inserted substring
while(i != -1){
i = content.indexOf("src", i + 1);
if(i != -1) sb.insert(i + (cont * stringToAdd.length()), stringToAdd);
++cont;
}
// Set the webView with the StringBuilder: sb.toString()
WebView detailWebView = (WebView) findViewById(R.id.web_view);
detailWebView.loadDataWithBaseURL(null, sb.toString(), "text/html", "utf-8", null);
}
Esperanza esta ayuda, me tomó algunas horas encontrar la manera de resolver esto.
Estoy enfrentando el mismo problema. ¿Ya lo resolvió? – JochenJung
Lo siento pero aún no lo he resuelto. Pensé que Tendría la solución aquí: http://developer.android.com/guide/webapps/targeting.html. Como dicen, agregué la etiqueta "width = device-width" en mi código HTML pero no funciona: (. Todavía estoy buscando una solución. – Trox
Excause me. ¿Has resuelto esto hasta ahora? – Yeung