0

私のアプリケーションは、webview を使用して、Web サイトから解析したコンテキストを表示します。ユーザーがgalaxy nexusでアプリを使用すると問題が発生します(1280 * 720の解像度が原因である可能性があります)

私のタグは単純に text-align:justify; を使用するだけです。ここに私のwebview設定があります

    WebView web = (WebView) root.findViewById(R.id.webView);                
    web.loadDataWithBaseURL(null,content, "text/html", "utf-8",null);
    web.getSettings().setUseWideViewPort(true);
    web.getSettings().setLoadWithOverviewMode(true);
    web.getSettings().setBuiltInZoomControls(true);

これが私のwebviewのxmlレイアウトです

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" android:id="@id/root" android:gravity="center_horizontal">

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </WebView>

    <com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        ads:adSize="BANNER"
        ads:adUnitId="a14fd0c4bb5aa9f"
        ads:background="@drawable/bg_main_repeat"
        ads:primaryTextColor="#FFFFFF"
        ads:secondaryTextColor="#CCCCCC" />

</LinearLayout>

Sony Xperia P(Android 2.3) でアプリをテストしましたが、問題は見つかりませんでした。800*480 のエミュレータ 4.0 でテストしても問題は見つかりませんでした。

私の問題は次のとおりです: http://images.droidsans.com/sites/default/files/Screenshot_2012-06-14-21-53-11.png ユーザーはダブルタップしてテキストを画面に合わせてズームする必要があります。

私は何をすべきか?私を助けてください

PS。下手な英語でごめんなさい。私はネイティブスピーカーではありません。

4

1 に答える 1

1

これを使用してみてください:

WebView.loadData("<head><style>* {margin:0;padding:0;font-size:15; text-align:justify}</style></head>" + "your data", "text/html", "UTF-8");
于 2012-06-14T16:19:20.293 に答える