18

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.

1

2 Answers 2

58

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

view.setVerticalScrollBarEnabled(false);
view.setHorizontalScrollBarEnabled(false);
Sign up to request clarification or add additional context in comments.

1 Comment

also he can do it in XML , for example , using : android:scrollbars="none" would hide all scrollbars.
4

In java add this code:

myScrollView.setVerticalScrollBarEnabled(false);
myScrollView.setHorizontalScrollBarEnabled(false);

In xml add following attribute to your ScrollView:

android:scrollbars="none"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.