到达顶部时自动显示的协调器布局滚动标志
Coordinator layout scroll flag to automatically show when the top is reached
我有一个使用协调器布局来显示 AppBarLayout 和回收器视图的片段,如下所示:
到目前为止布局文件是:
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="wrap_content"
app:elevation="4dp"
android:layout_height="wrap_content">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|snap">
<!-->Content removed<-->
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
我遇到的问题是,如果我打开回收器视图以便列表一直滚动到顶部,AppBarLayout 不会显示,除非我再次专门下拉。当回收器视图到达顶部时,是否有一个滚动标志使 AppBarLayout 下降,就好像它附加到回收器视图中的第一个项目一样?
不,传递惯性通常是 known issue 嵌套滚动,包括平台 API 和 CoordinatorLayout
使用的 API。
我有一个使用协调器布局来显示 AppBarLayout 和回收器视图的片段,如下所示:
到目前为止布局文件是:
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="wrap_content"
app:elevation="4dp"
android:layout_height="wrap_content">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|snap">
<!-->Content removed<-->
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
我遇到的问题是,如果我打开回收器视图以便列表一直滚动到顶部,AppBarLayout 不会显示,除非我再次专门下拉。当回收器视图到达顶部时,是否有一个滚动标志使 AppBarLayout 下降,就好像它附加到回收器视图中的第一个项目一样?
不,传递惯性通常是 known issue 嵌套滚动,包括平台 API 和 CoordinatorLayout
使用的 API。