AVEbrahimi
AVEbrahimi

Reputation: 19184

How to customize GridView vertical scrollbar?

I tried changing scrollbar of GridView:

android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"

scrollbar_vertical_thumb.xml

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

    <gradient
        android:angle="0"
        android:endColor="#005A87"
        android:startColor="#007AB8" />

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

</shape>

scrollbar_vertical_track.xml

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

    <gradient
        android:angle="0"
        android:endColor="#9BA3C5"
        android:startColor="#8388A4" />

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

</shape>

But it's not working and gridview keeps showing original scrollbar.

Upvotes: 0

Views: 1096

Answers (1)

zohreh
zohreh

Reputation: 1045

please try

android:scrollbarAlwaysDrawVerticalTrack=true
           android:scrollbars=vertical

if it didnt work then try android:scrollbarSize too

Upvotes: 1

Related Questions