自定义滚动条的Andr​​oid [英] Custom scrollbar Android

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

问题描述

我怎样才能让这个滚动条:

How I can make this scrollbar:

推荐答案

要改变拇指的图像,你可以简单地创建以下样式,并将其应用到您的滚动型:

To change the thumb image you can simply create the following style and apply it to your ScrollView:

<style name="your_style_name">  
    <item name="android:scrollbarAlwaysDrawVerticalTrack">true</item>
    <item name="android:scrollbarStyle">outsideOverlay</item>
    <item name="android:scrollbars">vertical</item>
    <item name="android:fadeScrollbars">false</item>
    <item name="android:scrollbarThumbVertical">@drawable/scroller_thumb</item>
</style>

在这里scroller_thumb是滚动条拇指自定义映像。

where scroller_thumb is your custom image for the scroller thumb.

也注意到以下属性:

  1. 。安卓fadeScrollbars,这是设置为false,使拇指的图像永久居留
  2. 在安卓scrollbarStyle这是设置为outsideOverlay使在绘制拇指形象的观点的边缘,并覆盖的规定在这里:<一href="http://developer.android.com/reference/android/view/View.html#attr_android%3ascrollbarStyle">android:scrollbarStyle

现在,为了把你想要的滚动条下的细线,只需添加包含行图像的图像视图,以滚动型(RelativeLayout的孩子的直接子作为直接孩子的滚动型可以让你的位置右侧视图的形象 - 所以这将是我的选择)

Now, in order to put the thin line you want under the scroller, simply add an image view containing the line image, to the direct child of the ScrollView (RelativeLayout child as a direct child for the ScrollView will allow you to position the image on the right side of the view - so this is would have been my choice).

,就是这样。

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆