How can I remove the scroll bar from a ScrollView programmatically?
setScrollBarStyle()
only changes only the style of the scrollbar.
I want to access the xml attribute android:scrollbars
programmatically. Is there any way to do that?
android:scrollbars
Defines which scrollbars should be displayed on scrolling or not.
If you have scroll element on your Android Intent like HorizontalScrollView, TextView or elements inside ScrollView, and you do not want the ScrollBar to be not visible when the element is scrolled just add the below line to your element XML tag.
setHorizontalScrollBarEnabled(boolean) - disable \ enable horizontal scrollbars. Show activity on this post. This is the property you should use on your ListView . All the best.
You cannot disable the scrolling of a ScrollView. You would need to extend to ScrollView and override the onTouchEvent method to return false when some condition is matched.
The following two method calls will remove the scrollbars in your scrollview:
view.setVerticalScrollBarEnabled(false);
view.setHorizontalScrollBarEnabled(false);
In java add this code:
myScrollView.setVerticalScrollBarEnabled(false);
myScrollView.setHorizontalScrollBarEnabled(false);
In xml add following attribute to your ScrollView
:
android:scrollbars="none"
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