android:scrollbarTrackHorizontal - Set the Color of Horizontal Track of Scrollbar in a TextView


Set the Color of Horizontal Track of Scrollbar in a TextView

android:scrollbarTrackHorizontal was added in API Level 1
Defines the horizontal 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 Horizontal 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.

  <HorizontalScrollView
        ...
        android:scrollbarTrackHorizontal = "@drawable/thumb01"
  />
5. Compile and run!

Related Articles:


Resources: