How to always show scrollbar

前端 未结 14 606
走了就别回头了
走了就别回头了 2020-11-30 18:59

The scrollbar in my scrollview is only visible when I start scrolling. How can I always show it?

相关标签:
14条回答
  • 2020-11-30 19:23

    Setting the android:scrollbarFadeDuration="0" will do the trick.

    0 讨论(0)
  • 2020-11-30 19:25

    As of now the best way is to use android:fadeScrollbars="false" in xml which is equivalent to ScrollView.setScrollbarFadingEnabled(false); in java code.

    0 讨论(0)
  • 2020-11-30 19:30

    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
    
    0 讨论(0)
  • 2020-11-30 19:33

    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"`
    
    0 讨论(0)
  • 2020-11-30 19:37

    setVertical* helped to make vertical scrollbar always visible programmatically

    scrollView.setScrollbarFadingEnabled(false);
    scrollView.setVerticalScrollBarEnabled(true);
    scrollView.setVerticalFadingEdgeEnabled(false);
    
    0 讨论(0)
  • 2020-11-30 19:38

    I had the same problem. The bar had the same background color. Try:

    android:scrollbarThumbVertical="@android:color/black"
    
    0 讨论(0)
提交回复
热议问题