I was wondering, how to check whether the current ScrollView
is scrollable? It seems that, there isn't public method called canScroll
or isScrollable
in ScrollView
.
Scrollable : You can move the ViewGroup inside the ScrollView up and down, and the scroll bar will be visible when you move it up and down. So, if there is only little rows in the ScrollView
, and they can fit inside single screen, ScrollView
is not scrollable then.
scrollView.viewTreeObserver
.addOnGlobalLayoutListener {
val isScrollable = scrollView.canScrollVertically(1)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With