How can I remove the scroll bar from a ScrollView programmatically?
如何以编程方式从ScrollView中删除滚动条?
setScrollBarStyle()
only changes only the style of the scrollbar.
setScrollBarStyle()只更改滚动条的样式。
I want to access the xml attribute android:scrollbars
programmatically. Is there any way to do that?
我想以编程方式访问xml属性android:scrollbars。有什么办法吗?
android:scrollbars
Defines which scrollbars should be displayed on scrolling or not.
android:滚动条定义哪些滚动条应该显示在滚动条上。
2 个解决方案
#1
38
The following will remove the scrollbar in your scrollview:
下面将删除scrollview中的滚动条:
View.setVerticalScrollBarEnabled(false);
View.setHorizontalScrollBarEnabled(false);
#2
2
In java add this code:
在java中添加以下代码:
myScrollView.setVerticalScrollBarEnabled(false);
myScrollView.setHorizontalScrollBarEnabled(false);
In xml add following attribute to your ScrollView
:
在xml中,向您的ScrollView添加以下属性:
android:scrollbars="none"
#1
38
The following will remove the scrollbar in your scrollview:
下面将删除scrollview中的滚动条:
View.setVerticalScrollBarEnabled(false);
View.setHorizontalScrollBarEnabled(false);
#2
2
In java add this code:
在java中添加以下代码:
myScrollView.setVerticalScrollBarEnabled(false);
myScrollView.setHorizontalScrollBarEnabled(false);
In xml add following attribute to your ScrollView
:
在xml中,向您的ScrollView添加以下属性:
android:scrollbars="none"