How to always show scrollbar

前端 未结 14 608
走了就别回头了
走了就别回头了 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:49

    There are 2 ways:

    • from Java code: ScrollView.setScrollbarFadingEnabled(false);
    • from XML code: android:fadeScrollbars="false"

    Simple as that!

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

    Style your scroll bar Visibility, Color and Thickness like this:

    <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/recycler_bg"
    
            <!--Show Scroll Bar-->
            android:fadeScrollbars="false"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbarFadeDuration="50000"
    
            <!--Scroll Bar thickness-->
            android:scrollbarSize="4dp"
    
            <!--Scroll Bar Color-->
            android:scrollbarThumbVertical="@color/colorSecondaryText"/>
    

    Hope it help save some time.

    0 讨论(0)
提交回复
热议问题