Android Froyo WebView doesn't scroll vertically
I have a WebView widget in my app that displays custom HTML content. This is my layout:
<?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"/>
</RelativeL开发者_开发问答ayout>
<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>
The code is really simple - the class that handles the layout also implements the WebViewClient methods. It loads the html data into the WebView.
The app works well on all OS's except Froyo. On Froyo the WebView doesn't respond to vertical scroll event - it can scroll horizontally though.
I had a onFling event listener - which has been disabled, but still no luck. Any help/hint is greatly appreciated. Thanks.
The moment you ask the question.... I found the issue and Im not sure if it is related to WebView. In my html template I have this
<meta name = "viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
This setting will cause the WebView to freeze up on Froyo. Later I found this Building web pages to support different screen densities and this question on stackoverflow. Hope it helps someone else down the line.
精彩评论