I want to custom a listview with a touchable fast scrollbar like Google play music app with vertical line with thumb image. It provides an easy and fast way to scroll with t
so for android api level < 11 there is special hack
// special hack for violet fast scroll
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
try {
java.lang.reflect.Field f = AbsListView.class.getDeclaredField("mFastScroller");
f.setAccessible(true);
Object o = f.get(root.findViewById(R.id.beam_contact_listview));
f = f.getType().getDeclaredField("mThumbDrawable");
f.setAccessible(true);
Drawable drawable = (Drawable) f.get(o);
drawable = getResources().getDrawable(R.drawable.sv_fastscroll);
f.set(o, drawable);
} catch (Exception e) {
e.printStackTrace();
}
}
this code plus solution for android api level >= 11 = solution for all android api levels )