Android:检查NestedScrollView是在底部还是在顶部
我正在使用NestedScrollView,我想检查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
谢谢大家! 也许可以检查是否在[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
}
}