アプリにカスタム 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 イベント リスナーがありましたが、これは無効になっていますが、まだ運がありません。どんな助け/ヒントも大歓迎です。ありがとう。