主要代码就是
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
android:scrollbarSize="12dip"/>
scrollbar_vertical_track.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>
scrollbar_vertical_thumb.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>