Change scrollbar selection ThumbVertical when scrolling is active

I tried changing the displayed scrollbar using the selector (state_pressed, state_focus, ...), but I did not work.

Scrollview

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll" 
android:layout_width="fill_parent"     
android:layout_height="wrap_content"
android:scrollbarSize="5dp"
android:scrollbarThumbVertical="@drawable/custom_scrollbar" >

Selector

<selector xmlns:android="http://schemas.android.com/apk/res/android" > 
     <item      
         android:state_pressed="true"     
         android:drawable="@drawable/scrollbar_pressed" /> 

     <item      
         android:state_focused="true"     
         android:drawable="@drawable/scrollbar_pressed" /> 

     <item android:drawable="@drawable/scrollbar" />
</selector> 

one of two drawings. The only difference is color

<shape xmlns:android="http://schemas.android.com/apk/res/android">    
    <gradient
        android:startColor="@color/grey" 
        android:endColor="@color/dark_grey"            
        android:angle="0" />
    <stroke 
        android:width="1dp"
        android:color="@color/white"/> 
    <corners android:radius="6dp" />
</shape>

any other solution for this?

+3
source share

All Articles