Search code examples
androidandroid-listviewandroid-scrollbar

make ListView Scrollbar difference and more useful


i have seen a lot of android apps those have a ListView that some differences with my ListViews. in theire ListView Scroll bar seen like this:

enter image description here

in picture above when you scroll your list that scroll bar will be shown and u can touch on it and scroll easier.

but in my app seen like this:

enter image description here

this is my layout xml code:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingBottom="4dp"
        android:text="@string/do"
        android:textSize="16dp" />

    <ListView
        android:id="@+id/lv"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/main_background"

        >
    </ListView>
</LinearLayout>

i had googled many times but i didnt find any trick. can anybody help me how i can make my scroll like picture one?


Solution

  • You can add these lines in your listview. It worked for me.

        android:fastScrollEnabled="true"
        android:scrollbars="none