且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

滚动条在ListView ...定制它。

更新时间:2023-10-04 20:14:22

在创建一个主题 RES / styles.xml

<style name="CustomTheme" parent="android:Theme">
    <item name="android:scrollbarTrackVertical">@drawable/scroll_track</item>
    <item name="android:scrollbarThumbVertical">@drawable/scroll_thumb</item>
</style>

@绘制/ scroll_track @绘制/ scroll_thumb 必须是指无论是九片图像或形状可绘。滚动轨道的图像是背景的滚动条。滚动拇指负责滚动柄。然后,只需应用的主题无论是整个应用程序或在AndroidManifest.xml中的活动:

@drawable/scroll_track and @drawable/scroll_thumb must refer either to nine patch images or to a shape drawables. Scroll track image is a background for the scroll bar. Scroll thumb is responsible for the scroll handle. Then just apply the theme either to whole application or to an activity within AndroidManifest.xml:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">