android:scrollbarTrackVertical - Set Color of Vertical Scrollbar Track in TextVew


How to Set Color of Vertical Scrollbar Track in TextVew

android:scrollbarTrackVertical was added in API Level 1
Defines the vertical scrollbar track drawable. By default, it only displays the track when you scroll the view.

1. Create an Android project, if you don't already have one.

2. Add a Vertical Scrollbar to a TextView

3. Add a Shape Drawable file named thumb01.xml, with the solid color as #FF0000. (This will be red.)

4. In the main.xml file, add the code below.

  <TextView
        ...
        android:scrollbarTrackVertical = "@drawable/thumb01"
  />

5. Compile and run!

Related Articles:


Resources: