当滚动处于活动状态时,更改scrollbarThumbVertical的drawable

时间:2012-04-11 09:23:12

标签: android listview scrollbar scrollview

我试图用选择器(state_pressed,state_focus,...)更改滚动条的drawable,但我没有用。

滚动视图

<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 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> 

两个抽奖中的一个。唯一的区别是颜色

<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>

任何其他解决方案?

0 个答案:

没有答案
相关问题