androidscrollbarandroid-scrollviewandroid-scrollbar

How can I change the width/thickness of a scrollbar?


Currently this is my scrollbar.xml file:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <gradient
        android:angle="45"
        android:centerColor="@color/blue"
        android:endColor="@color/blue"
        android:startColor="@color/blue" />

    <corners android:radius="8dp" />

</shape>

And this is my ScrollView:

<ScrollView
    android:id="@+id/scrollView1"
    android:scrollbarThumbVertical="@drawable/scrollbar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/btnBack" >

This is the scrollbar it gives me. It's good, except it's too thick and obvious. It may not look thick in this screenshot, but it really is.

enter image description here

Am I able to set a ScrollView property to adjust the width/thickness of the scrollbar? Or can I put a property in my gradient?


Solution

  • add the following property to your layout

    android:scrollbarSize="50dip"