Rozmiar tekstu WebView

Czasami, gdy ładuję moją stronę (brak statycznej zawartości, skonstruowanej w locie), widzę rozmiar czcionki za mały1. Jeśli przeładuję, widzę to poprawnie2. Idę tam iz powrotem i widzę to właściwie. A potem ... mały. Nie konkretna strona, nie w określonych godzinach. Nawet konkretna wersja: wdrażam na urządzeniu ICS, nie ma problemu, zmień coś (np. Rozmiar czcionki) i tutaj jest problem. To samo dotyczy wdrożeń w emulatorach 8 i 10.

Mój widok jest całkiem prosty:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:orientation="vertical" >
    <WebView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webviewArticle"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:padding="12dp" >
    </WebView>
</LinearLayout>

Konstrukcja HTML (parametr treści to sformatowany HTML)

String toShow = new StringBuffer()
    .append("<html>")
    .append("<head>")
    .append("<style type='text/css'>body{ font-size: large; color: #FFFFFF; background-color: #000000;}</style>")
    .append("</head>")
    .append(String.format(
        "<body><h1>%s</h1><div><img src='%s' alt='%s' style='width:100%%; height:auto' /></div><div style='background-color:#000000;'>%s</div><div><h3>%s</h3></div></body>",
        article.getTitle(),
        article.getImageLink().toString(),
        article.getTitle(),
        article.getContent().replace("%", "%25"), //html
        article.getAuthor()))
    .append("</html>")
    .toString();

mBrowser.getSettings().setBuiltInZoomControls(true);
mBrowser.setInitialScale(1);
CompatibilityUtils.setLoadWithOverviewMode(mBrowser, true); //set based on android version
mBrowser.getSettings().setUseWideViewPort(true);
mBrowser.loadDataWithBaseURL("fake://in/order/to/refresh", toShow, "text/html", "utf-8",null);

Jakaś podpowiedź?

Dodatkowy opis 12/09/25: jak sugerują zdjęcia, WebView uważa, że ​​dostępna przestrzeń jest o połowę mniejsza od ekranu i odpowiednio określa tekst. To jest dziwne. Najdziwniejsze jest to, że myśli o tekście (nagłówku nad obrazem i div poniżej), a nie o obrazie !!!

questionAnswers(1)

yourAnswerToTheQuestion