How to create custom Vertical or Horizontal Scrollbar for ListView, ScrollView, etc. in Android
Here is the screenshot of my custom Android scrollbar.
Below you can download source code of this sample Android project
How do the same.
It is so simple. To make custom scrollbar for ListView or ScrollView, etc. you need set android:scrollbarThumbVertical or android:scrollbarThumbVertical for
<listview android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarthumbvertical="@drawable/thumb"/>
Also it can be used with ScrollView, etc.
Here you can download source code of sample Android project.
2 Comments
shilpa · 3 November, 2014 at 11:29
Can you upload the snippet to add an onclick handler for the scrollbar image?
Igor Khrupin · 11 November, 2014 at 20:23
Hi Shilpa, You unable handle onclick on scrollbar. Here is another sample with FastScroll functionality. In this sample I make changing the thumb drawable when user press thumb. http://www.hrupin.com/2014/11/how-to-create-custom-style-for-fast-scroll-scrollbar-in-android
Hope it helps. Also please let me know if you get another solution.