CoordinatorLayout+AppBarLayout+RecyclerView 達(dá)到吸頂時(shí)
當(dāng)RecyclerView達(dá)不到滾動(dòng)條件沒有鋪滿一屏?xí)r练对,只有AppBarLayout部分會(huì)滾動(dòng)觸發(fā)吸頂效果娩缰,Recyclerview沒有滑動(dòng)效果儿礼,當(dāng)RecyclerView達(dá)到滾動(dòng)條件時(shí)可以觸發(fā)
可以修改
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="16dp"
android:id="@+id/recycle_box"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
/>
</RelativeLayout>
RecyclerView最后一項(xiàng)顯示不全
在 CollapsingToolbarLayout.中添加android:minHeight="?actionBarSize” 屬性
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:minHeight="?actionBarSize"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">