在ScrollView中加上这两个属性:
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
在drawable中加入两个XML:
scrollbar_vertical_track:
<?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>
scrollbar_vertical_thumb:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="@color/violet" android:endColor="@color/violet"
android:angle="0"/>
<corners android:radius="6dp" />
</shape>
即可。