Remove scrollbar from ScrollView programmatically in Android

weakwire picture weakwire · Jan 18, 2012 · Viewed 12.7k times · Source

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.

Answer

Viking picture Viking · Jan 18, 2012

The following two method calls will remove the scrollbars in your scrollview:

view.setVerticalScrollBarEnabled(false);
view.setHorizontalScrollBarEnabled(false);