I have a task to create a custom scrollbar for list view and to my knowledge the way you can customize your scrollbar is very limited on android. Is it possible to achieve e
Create a theme in res/styles.xml:
<style name="CustomTheme" parent="android:Theme">
<item name="android:scrollbarTrackVertical">@drawable/scroll_track</item>
<item name="android:scrollbarThumbVertical">@drawable/scroll_thumb</item>
</style>
@drawable/scroll_track and @drawable/scroll_thumb must refer either to nine patch images or to a shape drawables. Scroll track image is a background for the scroll bar. Scroll thumb is responsible for the scroll handle. Then just apply the theme either to whole application or to an activity within AndroidManifest.xml:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">
you can make this like i explaind and also put the pic in drawable as u want.
At the activity level, you could specify various attributes to specify the scrollbars. For the given scrollbar, you might have to specify scrollbarThumbVertical, scrollbarTrackVertical attributes. The list of customizable attributes are specified in R.attr.
Create these two xml file in drawable
scrollbar_vertical_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#FF6600"
android:startColor="#FF6600" />
<corners android:radius="4dp"/>
</shape>
scrollbar_vertical_track.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#FFFFFF"
android:startColor="#FFFFFF" />
<corners android:radius="4dp" />
</shape>
Use these two xml file in list_view.xml
list_view.xml
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dp"
android:divider="#FF6600"
android:listSelector="@drawable/list_selector"
android:layoutAnimation="@anim/listview_layout_animation"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
android:scrollbarSize="3dip"
android:fastScrollEnabled="true">
I just ended up using separate Seekbar next to ListView.