The scrollbar in my scrollview is only visible when I start scrolling. How can I always show it?
Setting the android:scrollbarFadeDuration="0"
will do the trick.
As of now the best way is to use android:fadeScrollbars="false"
in xml which is equivalent to ScrollView.setScrollbarFadingEnabled(false);
in java code.
Simple and easy. Add this attribute to the ScrollBar
:
android:fadeScrollbars="false"
Or you can do this in java:
scrollView.setScrollbarFadingEnabled(false);
Or in kotlin:
scrollView.isScrollbarFadingEnabled = false
Setting this will do the trick. Change the @drwable for own style.
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="@drawable/scroll"`
setVertical* helped to make vertical scrollbar always visible programmatically
scrollView.setScrollbarFadingEnabled(false);
scrollView.setVerticalScrollBarEnabled(true);
scrollView.setVerticalFadingEdgeEnabled(false);
I had the same problem. The bar had the same background color. Try:
android:scrollbarThumbVertical="@android:color/black"