我在 CoordinatorLayout 中有一个 viewpager,如下所示:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme"/>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
在 viewpager 中,每个片段都是一个 webview。
代码可以运行,但是当我滚动我的 webview 时。屏幕外的 tablayout 不起作用。它只是在标题。
更新:
我尝试使用 relativelayout 来满足我的视图并使用 NestedScrollView 作为 relativelayout 的父级,但 webview 消失了(进度条显示正常)。是bug???
这是我的片段布局:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="300dp">
<ProgressBar
android:id="@+id/pb"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:indeterminateOnly="false"
android:max="100"
android:progressDrawable="@drawable/progress_bar_states"></ProgressBar>
<com.handmark.pulltorefresh.library.PullToRefreshWebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/pb" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>