how to detect the position of the scroll nestedscrollview android at the bottom?

后端 未结 7 1014
不知归路
不知归路 2020-12-04 22:19

i just want to detect the position of the scroll nestedscrollview android at the bottom, and the to call function. my code is :

scroll.getViewTreeObserver()
         


        
7条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 22:40

    Webserveis answered right, but it needs a little bit of changes in onScrollChange (override method), like this:

    if (scrollY === v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight()) {
       // end of the scroll view
    }
    

    Kotlin:

    if (scrollY == v.getChildAt(0).measuredHeight - v.measuredHeight) {
        // end of the scroll view
    }
    

提交回复
热议问题