android:scrollbarStyle - Change the Scrollbar Location/Style in a TextView

How to Change the Scrollbar Location/Style in a TextView

added in API Level 1

Controls the scrollbar style and position. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use insideOverlay or insideInset. If you want them to appear at the edge of the view, ignoring the padding, then you can use outsideOverlay or outsideInset.
The default scrollbar is a the insideOverlay.

1. Add a HorizontalScrollView to a TextView, in your main.xml file.

2. In the main.xml file, add the code below. The scrollbar will appear outside the TextView area.

  <HorizontalScrollView
        ...
       android:scrollbarStyle = "insideInset"
  />

3. All the styles include:

insideOverlay - Inside the padding and overlaid, default scrollbar style.
insideInset - Inside the padding and inset (The scrollbar appears to be outside the TextView
outsideOverlay - Edge of the view and overlaid
outsideInset - Edge of the view and inset (The scroll appears to be outside the TextView)

4. Compile and run!

Related Articles:

Resources: