本文介绍了listView 中的滚动条...自定义它.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is there a way to customize the standard scrollbar that ListView provides in android..? I haven't got a definitive answer on this yet :/

推荐答案

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>

@drawable/scroll_track@drawable/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">

这篇关于listView 中的滚动条...自定义它.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 06:59