I have an app with a ScrollView, and I don\'t want the scrollbar to appear on the screen. How can I hide the scrollbar in a ScrollView while making sure scrolling still work
If you need to do this programmatically, you can set either one or both of:
scrollView.isHorizontalScrollBarEnabled = false
scrollView.isVerticalScrollBarEnabled = false
If you'll be applying both regularly, try adding this extension
fun ScrollView.noScrollbars() {
isHorizontalScrollBarEnabled = false
isVerticalScrollBarEnabled = false
}
To easily allow switching, you can add an optional boolean
fun ScrollView.noScrollbars(hide: Boolean = true) {
isHorizontalScrollBarEnabled = !hide
isVerticalScrollBarEnabled = !hide
}