CoronaPintu
CoronaPintu

Reputation: 1875

Android Scrollview thumview change

in application listview i had more than 1000 data in listview and its tedious to scroll. i try to change scroll thume but cannot change.i requre scroll thum like below image

<ListView
 android:id="@+id/listview"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:layout_below="@+id/layoutProduct"
 android:background="#00000000"
 android:cacheColorHint="#00000000"
 android:dividerHeight="1dp"
 android:fadeScrollbars="true"
 android:fadingEdge="none"
 android:scrollbarSize="10dp"
 android:scrollbarThumbVertical="@drawable/a_apptheme_fastscroll_thumb_holo"
 android:focusable="true"
 android:focusableInTouchMode="true"
 android:listSelector="#00000000"
 android:scrollingCache="false" >
 </ListView>

Thum Image

User can drag scrol thume

Upvotes: 0

Views: 213

Answers (2)

Rakesh Rangani
Rakesh Rangani

Reputation: 1049

In your ListView XML definition, add

android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true"

Create file fastscroll_thumb.xml in the res/drawable folder as follows:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:state_pressed="true" android:drawable="@drawable/fastscroll_pressed" />
      <item android:drawable="@drawable/fastscroll" />
</selector>

Create a values folder in the res folder. Create themes.xml files in res/values as follows:

<resources>
  <style name="ApplicationTheme">
      <item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item>
  </style>
</resources>

Upvotes: 0

Simon
Simon

Reputation: 11190

Call the setFastScrollEnabled(true); method on your ListView. http://developer.android.com/reference/android/widget/AbsListView.html#setFastScrollEnabled(boolean)

Upvotes: 1

Related Questions