Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:检查NestedScrollView是在底部还是在顶部_Android_Nestedscrollview - Fatal编程技术网

Android:检查NestedScrollView是在底部还是在顶部

Android:检查NestedScrollView是在底部还是在顶部,android,nestedscrollview,Android,Nestedscrollview,我正在使用NestedScrollView,我想检查NestedScrollView是在底部还是在顶部:-) 有什么建议吗? 谢谢大家! 也许可以检查是否在[0]中,创建一个SetOnScrollChangeListener BottomSheet.SetOnScrollChangeListener(this); 侦听器接口的内部 public void OnScrollChange(NestedScrollView v, int scrollX, int scrollY, int old

我正在使用NestedScrollView,我想检查NestedScrollView是在底部还是在顶部:-)

有什么建议吗?
谢谢大家!

也许可以检查是否在[0]中,

创建一个SetOnScrollChangeListener

BottomSheet.SetOnScrollChangeListener(this);
侦听器接口的内部

  public void OnScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
    {
        if (scrollY == 0)
        {
            //Do something here when ur scroll reached the bottom by scrolling up
        }

        if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight()))
        {
            //Do something here when ur scroll reached top by scrolling down
        }
    }
检查这个:它对我有效。
  public void OnScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
    {
        if (scrollY == 0)
        {
            //Do something here when ur scroll reached the bottom by scrolling up
        }

        if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight()))
        {
            //Do something here when ur scroll reached top by scrolling down
        }
    }