虽然很少用,但是还是有应用会有自定义ListView,GridView,ScrollView等滚动条样式,这样会使得页面更加融洽美观。

其实自定义样式很简单:
1、如果你的scrollbar是Vertical的,设置以下属性

android:scrollbarThumbVertical="@drawable/scrollbar_indicator"android:scrollbarTrackVertical="@drawable/scrollbar_bg"

2、如果你的scrollbar是horizontal的,设置以下属性

android:scrollbarThumbHorizontal="@drawable/scrollbar_indicator"android:scrollbarTrackHorizontal="@drawable/scrollbar_bg"

android:scrollbarThumbVertical和android:scrollbarThumbHorizontal设置的是滚动条指示器的图片,会跟着滑动而滑动;

android:scrollbarTrackVertical和android:scrollbarTrackHorizontal设置的是滚动条背景。

需要注意的是:
a、属性里面必须是图片,不能直接设置颜色值;
b、指示器会根据item的多少改变高度,因此建议自定义的图片制作成点九(.9)

更多相关文章

  1. android 读取本地超大图片
  2. android 中的 edittext属性大全
  3. Android学习笔记:androidmanifest.xml 高级属性
  4. 关于android:configChanges的属性
  5. LinearLayout && RelativeLayout 常用属性
  6. Android中自定义属性(attrs.xml,TypedArray的使用)
  7. Android 图片加水印
  8. Android gallery实现图片的左右循环旋转源码分享
  9. 通过 http post 方式上传多张图片

随机推荐

  1. android RecyclerView基本使用(上)
  2. Android(安卓)settings.db数据库中添加一
  3. multipart/form-data图片上传实现方法
  4. Android之使用AchartEngineActivity引擎
  5. 网络连接之——xUtils 介绍(三)
  6. Android(安卓)编译错误 [kapt] An except
  7. Android之NDK
  8. android:allowTaskReparenting(clearTask
  9. LibGDX输入模块之陀螺仪
  10. LinearLayout的layout_weight的使用