1. 程式人生 > >Android自定義ListView Scrollbar樣式

Android自定義ListView Scrollbar樣式

轉自:http://blog.csdn.net/airy_t/article/details/7646958

listview的scrollbar自定義樣式,感謝原作者的分享。(如有冒犯,請通知我立即刪除。)

android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"        //滾動條背景

    android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"    //滾動條

scrollbar_vertical_track.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#3333FF" android:endColor="#8080FF"
            android:angle="0"/>
    <corners android:radius="6dp" />
</shape>

scrollbar_vertical_thumb.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#505050" android:endColor="#C0C0C0"
            android:angle="0"/>
    <corners android:radius="0dp" />
</shape>

listview scrollbar一直顯示方法:

android:scrollbarFadeDuration="0"