listView中的scrollBar ...自定义它.

cj1*_*098 8 customization android listview scrollbar

有没有办法自定义ListView在Android中提供的标准滚动条..?我还没有得到明确的答案:/

Kon*_*rov 15

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>
Run Code Online (Sandbox Code Playgroud)

@drawable/scroll_track并且@drawable/scroll_thumb必须参考九个补丁图像或形状drawables.滚动轨迹图像是滚动条的背景.Scroll thumb负责滚动手柄.然后只需将主题应用于整个应用程序或AndroidManifest.xml中的活动:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">
Run Code Online (Sandbox Code Playgroud)

  • 用作拇指的图像是拉伸..即使我使用9patch图像,我没有得到所需的结果....... (2认同)