Android Code Snippet Scrollbar Color

Discussion in 'Code Snippets' started by Erel, Feb 21, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User

    This code uses reflection to change the ScrollView scroll bar color:


    Sub SetScrollbarColor(sv As ScrollView, clr As Int)
    Dim r As Reflector
       r.Target = sv
       r.Target = r.GetField(
       r.Target = r.GetField(
    Dim cd As ColorDrawable
    "setVerticalThumbDrawable"Array(cd), Array As String(""))
    End Sub
    Note that it is based on private API so it can be broken in a future version of Android.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice