android - 如何始终显示滚动条
滚动视图中的滚动条仅在我开始滚动时可见。我怎么能一直展示它?
jul asked 2019-03-07T01:36:35Z
13个解决方案
450 votes
截至目前,最好的方法是在xml中使用android:fadeScrollbars="false",相当于java代码中的ScrollView.setScrollbarFadingEnabled(false);。
Rejinderi answered 2019-03-07T01:36:48Z
47 votes
设置android:scrollbarFadeDuration="0"就可以了。
Tanmay Mandal answered 2019-03-07T01:37:13Z
37 votes
有两种方式:
来自Java代码:android:fadeScrollbars="false"
来自XML代码:android:fadeScrollbars="false"
就那么简单!
Tudor Luca answered 2019-03-07T01:37:53Z
9 votes
尝试这个,因为当我想为TextView执行此操作时,上述建议对我不起作用:
TextView.setScrollbarFadingEnabled(false);
祝好运。
Camille Sévigny answered 2019-03-07T01:38:21Z
8 votes
请尝试android:scrollbarAlwaysDrawVerticalTrack="true"进行垂直。并尝试android:scrollbarAlwaysDrawHorizontalTrack="true"水平
Saurabh Pareek answered 2019-03-07T01:38:47Z
7 votes
既然以上都没有为我工作,那么这是做了什么:android:scrollbarDefaultDelayBeforeFade="500000"
Emiam answered 2019-03-07T01:39:13Z
7 votes
android:scrollbarFadeDuration="0"退出应用程序并重新启动后,有时无效。 所以我添加gallery.setScrollbarFadingEnabled(false);到活动,它的工作原理!
icegee answered 2019-03-07T01:39:41Z
7 votes
不要忘记添加android:scrollbars="vertical"以及android:fadeScrollbars="false",否则在某些情况下根本不会显示。
Sir Codesalot answered 2019-03-07T01:40:10Z
5 votes
这两个一起为我工作:
android:scrollbarFadeDuration="0"
android:scrollbarAlwaysDrawVerticalTrack="true"
sealskej answered 2019-03-07T01:40:37Z
2 votes
setVertical *帮助使垂直滚动条始终以编程方式可见
scrollView.setScrollbarFadingEnabled(false);
scrollView.setVerticalScrollBarEnabled(true);
scrollView.setVerticalFadingEdgeEnabled(false);
Dmitry Bryliuk answered 2019-03-07T01:41:05Z
1 votes
为您的滚动条设置可见性,颜色和厚度,如下所示:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/recycler_bg"
android:fadeScrollbars="false"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarFadeDuration="50000"
android:scrollbarSize="4dp"
android:scrollbarThumbVertical="@color/colorSecondaryText"/>
希望它能节省一些时间。
Hitesh Sahu answered 2019-03-07T01:41:40Z
0 votes
设置android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="@drawable/scroll"
将为自己的风格改变@drwable
Muthu Krishnan answered 2019-03-07T01:42:14Z
0 votes
我有同样的问题。 条形图具有相同的背景颜色。 尝试:
android:scrollbarThumbVertical="@android:color/black"
Boris Karloff answered 2019-03-07T01:42:42Z