我在我的安卓应用程序中添加了Toolbar
、Tablayout
和Viewpager
。在TabLayout
中有三个Tabs
,每个都显示一个WebView
。
我将WebView
放在NestedScrollView
中,以便在用户向下/向上滚动WebView
时隐藏/显示Toolbar
。在Android 3.0或更高版本中,Toolbar
会隐藏。
但不幸的是,在Android 2.3或更低版本中,WebView
一开始无法滚动。我必须滑动到另一个标签页,然后再返回第一个Tab
,WebView
才开始滚动。
我想要什么?
我希望在Android 2.3
或更低版本中,WebView
能够毫无问题地滚动。
我的WebView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="1dp">
<WebView
android:id="@+id/webviewtool"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:numColumns="1"
android:scrollbars="none"
android:focusableInTouchMode="false"
android:focusable="false"
android:background="#FFFFFF" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>