NestedScrollView阻止Nougat上的bug(API 25)

Dim*_*zis 18 android scroll android-support-library nestedscrollview android-7.0-nougat

我在Nexus 5x(7.1.2)和Google Pixel(7.1.1)上使用NestedScrollView时遇到了一个奇怪的问题.在其他操作系统版本上它运行正常.

举起动画有时会在举起手指后立即停止.它会停滞不前,接下来的几次飞行也可能会停止.为了重现它,你需要上下几次投掷.

在日志中,这些flings在速度,方向等方面看起来几乎相同,所以我找不到这个bug的真正原因.

NestedScrollView并不一定需要的内部CoordinatorLayout,也可以没有NestedScrollingChild在所有.

例如,此错误可以使用以下NestedScrollView子项之一重现:

1)LinearLayout填充TextViews

2) WebView

3)LinearLayout填充RecyclerViews.

我知道RecyclerView内部和行为的可能问题CoordinatorLayout,但它没有关系.所以请不要提及任何

recyclerView.getLayoutManager().setAutoMeasureEnabled(true);
recyclerView.setNestedScrollingEnabled(false);
Run Code Online (Sandbox Code Playgroud)

或类似的东西.

代码示例:

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:text="Put a super long text here"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:text="Put a super long text here"/>

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)

Dim*_*zis 7

所以这显然是NestedScrollView中的一个错误.我为此做了一个解决方法,但仍在等待Google方面的正确修复.

https://github.com/Dimezis/FlingableNestedScrollView/

编辑:

看起来问题已在支持lib 26.0.0-beta2中修复

https://chris.banes.me/2017/06/09/carry-on-scrolling/

编辑2:虽然现在滚动工作正常,但在我的应用程序中,我可以不断重现此错误:

https://issuetracker.google.com/issues/37051723

如果有人遇到它,你可以在提到的线程中找到一个解决方法.