Android 使用BottomSheetBehavior滚动期间的dx为零

Android 使用BottomSheetBehavior滚动期间的dx为零,android,swipe,horizontal-scrolling,bottom-sheet,coordinator-layout,Android,Swipe,Horizontal Scrolling,Bottom Sheet,Coordinator Layout,我有自己的习惯行为: public class CustomBehavior extends BottomSheetBehavior { public CustomBehavior(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onNestedPreScroll(CoordinatorLayout coordinator

我有自己的习惯行为:

public class CustomBehavior extends BottomSheetBehavior {

    public CustomBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, View 
    child, View target, int dx, int dy, int[] consumed) {
        super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, 
        consumed);
    }
}
我在xml代码中使用它

<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.support.v4.widget.NestedScrollView
        android:id="@+id/bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="350dp" 
        android:clipToPadding="true"
        android:background="@android:color/holo_orange_light"
        app:layout_behavior=
            "com.hackspace.bottomsheetproblem.CustomBehavior">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="text"/>

    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>

实际上,我的目标是对默认行为中的检测滑动进行一些更改。我需要我的自定义行为只对垂直(或几乎垂直)滑动做出反应,甚至对几乎水平的滑动也没有反应。

如果我理解正确,问题是
dx
仍然为零?@GiovanniTerlingen-Yup。所以我无法检测dx是否大于dy。愚蠢的问题,但你确定你正确地记录了
dx
?@GiovanniTerlingen是的,我确定。@GiovanniTerlingen我只是不确定,我选择了正确的方向来解决我的问题。
dx: 0, dy: -1
dx: 0, dy: -70
dx: 0, dy: -108
dx: 0, dy: -85
dx: 0, dy: -44
dx: 0, dy: -16
dx: 0, dy: 16
dx: 0, dy: 44
dx: 0, dy: 62
dx: 0, dy: 84
dx: 0, dy: 58
dx: 0, dy: 54
dx: 0, dy: 43
dx: 0, dy: 17
dx: 0, dy: -20
dx: 0, dy: -42