我在 CollapsingToolbarLayout 里面有 ImageView 和 NestedScrollView时
遇到了完全相同的问题。松开手指时,滚动滚动停止。
但是,我注意到了一些奇怪的事情。如果您从用OnClickListener(例如Button)的视图开始用手指滚动,则滑动滚动会完美工作。
因此,我用一个奇怪的解决方案将其修复。设置OnClickListener(什么都不做)上的直接孩子 NestedScrollView
。然后,它完美地工作!
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:id="@+id/content_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- Page Content --> </LinearLayout></android.support.v4.widget.NestedScrollView>
给直接子级(LinearLayout)一个ID,并在Activity中设置OnClickListener
ViewGroup mContentContainer = (ViewGroup) findViewById(R.id.content_container); mContentContainer.setonClickListener(this);@Overridepublic void onClick(View view) { int viewId = view.getId();}笔记:
使用支持设计库25.0.1测试
具有scrollFlags =“ scroll | enterAlwaysCollapsed”的CollapsingToolbarLayout“



