2

アプリにカスタム HTML コンテンツを表示する WebView ウィジェットがあります。これは私のレイアウトです:

<?xml version="1.0" encoding="utf-8"?>    
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/main_article_view"
 >
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:background="@drawable/header_background">

<Button 
    android:id="@+id/article_next"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:background="@drawable/right_segment"
    android:layout_centerVertical="true"
    android:layout_alignParentRight="true"
    android:layout_marginRight="2dip"
/>

<Button 
    android:id="@+id/article_previous"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:background="@drawable/left_segment"
    android:layout_centerVertical="true"
    android:layout_alignBaseline="@id/article_next"
    android:layout_toLeftOf="@id/article_next"
/>



<ImageView 
    android:layout_width="wrap_content"
    android:id="@+id/article_nav_logo" 
    android:layout_height="wrap_content"
    android:background="@drawable/app_logo"
    android:layout_toLeftOf="@id/article_previous"
    android:layout_centerVertical="true"
    android:layout_marginRight="15dp"/>

</RelativeLayout>

<com.myapp.android.NavBar
    android:id="@+id/vertical_navbar"
    android:layout_width="fill_parent"
    android:layout_height="45dp"
/>


<WebView
        android:id="@+id/webkit"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
/>


</LinearLayout>

コードは非常に単純です。レイアウトを処理するクラスは、WebViewClient メソッドも実装しています。HTML データを WebView にロードします。

このアプリは、Froyo を除くすべての OS で正常に動作します。Froyo では、WebView は垂直スクロール イベントに応答しませんが、水平方向にスクロールできます。

onFling イベント リスナーがありましたが、これは無効になっていますが、まだ運がありません。どんな助け/ヒントも大歓迎です。ありがとう。

4

1 に答える 1

1

あなたが質問をした瞬間....問題を見つけましたが、それがWebViewに関連しているかどうかはわかりません。私のhtmlテンプレートにはこれがあります

<meta name = "viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

この設定により、Froyo で WebView がフリーズします。後で、このBuilding web pages to support different screen densitiesと、この質問 on stackoverflowを見つけました。それが他の誰かに役立つことを願っています。

于 2010-06-22T14:45:14.860 に答える