<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="@color/white"
app:expandedTitleTextAppearance="@style/TextAppearance.Title"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/len_224"
android:contentDescription="@string/app_name"
android:foreground="@color/black_alpha_48"
android:scaleType="centerCrop"
android:src="@drawable/bg" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/actionBarWithStatusBarSize"
android:paddingTop="@dimen/statusBarSize"
app:layout_collapseMode="pin">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red_900"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior" />
</android.support.design.widget.CoordinatorLayout>
老师,上面是个布局的代码, 当我滑动AppbarLayout部分时,很流畅, 当我滑动ViewPager(换成RrecyclerView也一样)部分时,却会卡顿, 当我吧ViewPager放进AppbarLayout时,滑起来才流畅(当然,我觉得这儿滑的就是AppbarLayout…) 老师遇到过这种问题吗?