をスクロールしたとき、私は私の活動の一つで崩壊ツールバーを実装して、ツールバーをスクロールすると崩壊しない崩壊しない折りたたみ:はツールバーとrecyclerviewは
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:fitsSystemWindows="true"
android:layout_height="@dimen/app_bar_height"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:scrollbars="none" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
私はまた、Gradleのために必要なライブラリを追加しました。スクロールダウンするとき、ツールバーは同じ位置にとどまります。なぜこれが起こっているのか?
私はそのrecyclerview –
@RainMan内部の別のレイアウトを持っている:あなたはこの中のLinearLayoutは必要ありません。 CoordinatorLayoutは、その動作に基づいてViewsを配置します。 'LinearLayout'を削除し、' RecyclerView'の周りで 'SwipeRefreshLayout'を動かし、トップレベルを' CoordinatorLayout'にします。 – DeeV
@DeeV、コメントありがとう、私はあなたが説明したのと同じ方法を行ったが、今はrecycleviewの内容がツールバーの上にある。 –