Android ListView not show scrollbar when fastscroll

430 Views Asked by At

When I scroll the list, fastscroll thumb is showed but the scrollbar thumb and track not showed.

Here is my XML code:

<ListView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbarTrackVertical="@drawable/bg_scroll"
        android:scrollbarThumbVertical="@drawable/scroll_bar"
        android:divider="@drawable/list_line"
        android:fastScrollEnabled="true"`/>

My fastscroll thumb drawable is setted in styles.xml AppTheme.

2

There are 2 best solutions below

3
Gouse Mohiddin On

Please check the data you passed to list view because fast scroll is only displayed when you have more list items to scroll.

Make sure you have these lines in recycler view tag

app:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
app:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
app:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
app:fastScrollVerticalTrackDrawable="@drawable/line_drawable">
1
Bikash Das On

Since you have set android:fastScrollEnabled="true" you need to set the fastScroll properties like android:fastScrollTrackDrawable="@drawable/"and 'android:fastScrollThumbDrawable="@drawable/". And also consider what @Gouse Mohiddin has said. You need to have enough rows inside to make it scrollable.