Scrollbar color in RecyclerView

前端 未结 3 1431
既然无缘
既然无缘 2020-12-13 02:35

How can I change the color of my scrollbar in a recyclerView?

I have the scrollbar but I want to change its color. My recyclerView is like this:

 <         


        
3条回答
  •  暖寄归人
    2020-12-13 02:50

    In case you want to further style your scrollbars, create two drawable resource file in your drawable folder as 1. scrollbar_track and 2. scrollbar_thumb

    scrollbar_track.xml

    
    
        
            
    
    

    scrollbar_thumb.xml

    
    
    
        
    
        
    
     
    

    Now, create a style named scrollbar_style in your styles.xml file as:

    
    

    Finally, to apply this style to the scrollbar in your recyclerview, add
    style="@style/scrollbar_style"
    to your recyclerview.

    In your case:

    
    

提交回复
热议问题