How to check whether ScrollView is scrollable

前端 未结 3 2002
南旧
南旧 2020-12-17 19:14

I was wondering, how to check whether the current ScrollView is scrollable? It seems that, there isn\'t public method called canScroll or isS

3条回答
  •  Happy的楠姐
    2020-12-17 19:32

    I think I might be missing something, but shouldn't it be as simple as checking if

    scrollView.getHeight() >= parentView.getMeasuredHeight()
    

    you might actually need: scrollView.getChildAt(0).getHeight() and/or parentView.getHeight() instead, but the idea is the same.

提交回复
热议问题