1. activity_maim.xml
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="fill_parent"
  3. android:layout_height="fill_parent"
  4. android:orientation="vertical" >
  5. <ScrollView
  6. android:id="@+id/view1"
  7. android:layout_width="100dip"
  8. android:layout_height="120dip"
  9. android:background="@android:color/white"
  10. android:padding="8dip"
  11. android:scrollbarStyle="insideOverlay" >
  12. <TextView
  13. android:layout_width="fill_parent"
  14. android:layout_height="wrap_content"
  15. android:background="@android:color/darker_gray"
  16. android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
  17. android:textColor="#ffffff" />
  18. </ScrollView>
  19. <ScrollView
  20. android:id="@+id/view2"
  21. android:layout_width="100dip"
  22. android:layout_height="120dip"
  23. android:background="@android:color/white"
  24. android:padding="8dip"
  25. android:scrollbarStyle="insideInset" >
  26. <TextView
  27. android:layout_width="fill_parent"
  28. android:layout_height="wrap_content"
  29. android:background="@android:color/darker_gray"
  30. android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
  31. android:textColor="#ffffff" />
  32. </ScrollView>
  33. <ScrollView
  34. android:id="@+id/view3"
  35. android:layout_width="100dip"
  36. android:layout_height="120dip"
  37. android:background="@android:color/white"
  38. android:padding="8dip"
  39. android:scrollbarStyle="outsideOverlay" >
  40. <TextView
  41. android:layout_width="fill_parent"
  42. android:layout_height="wrap_content"
  43. android:background="@android:color/darker_gray"
  44. android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
  45. android:textColor="#ffffff" />
  46. </ScrollView>
  47. <ScrollView
  48. android:id="@+id/view4"
  49. android:layout_width="100dip"
  50. android:layout_height="120dip"
  51. android:background="@android:color/white"
  52. android:padding="8dip"
  53. android:scrollbarStyle="outsideInset" >
  54. <TextView
  55. android:layout_width="fill_parent"
  56. android:layout_height="wrap_content"
  57. android:background="@android:color/darker_gray"
  58. android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
  59. android:textColor="#ffffff" />
  60. </ScrollView>
  61. </LinearLayout>

2. 运行结果截图:insideInset、insideOverlay、outsideInset、outsideOverlay分别对应下图左边解释!

3.android:scrollbarStyle可以定义滚动条的样式和位置,用于Listview、scrollview等滚动view,可选值有insideOverlay、insideInset、outsideOverlay、outsideInset四种。
其中inside和outside分别表示是否在view的padding区域内,overlay和inset表示覆盖在view上或是插在view后面,所以四种值分别表示:
insideOverlay:默认值,表示在padding区域内并且覆盖在view上
insideInset:表示在padding区域内并且插入在view后面
outsideOverlay:表示在padding区域外并且覆盖在view上
outsideInset:表示在padding区域外并且插入在view后面
4.自定义scrollbar
android:scrollbars="vertical"
android:fadeScrollbars="true" //true scrollbar不滚动隐藏
android:scrollbarThumbVertical="@drawable/scrollbar" //自定义scrollbar
        android:scrollbarTrackHorizontal="@drawable/scrollbar_bg"   //自定义scrollbar背景
android:scrollbarStyle="outsideInset" //scrollbar风格
 

android:scrollbar的一些属性的更多相关文章

  1. Android -----listView的重要属性

    android:transcriptMode="alwaysScroll" android:cacheColorHint="#00000000" android ...

  2. android中xml tools属性详解

    第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...

  3. Android读取自定义View属性

    Android读取自定义View属性 attrs.xml : <?xml version="1.0" encoding="utf-8"?> < ...

  4. android中xmlns:tools属性详解

    今天读到一篇总结的非常棒的文章,写的逻辑很清晰也很实用,很少见到如此棒的文章了.就原文转发过来,我把格式给整理了一下,分享给园子里的各位朋友!好久没写博客了,就为2015年的11月留份纪念吧.希望对你 ...

  5. Mono for Android布局控件属性小结

    1. layout_weight 用于给一个线性布局中的诸多视图的重要度赋值. 所有的视图都有一个layout_weight值,默认为零,意思是需要显示 多大的视图就占据多大的屏幕空 间.若赋一个高于 ...

  6. 【Android】使用persist属性来调用脚本文件

    Android系统中有许多属性,属性由两个部分组成:name & value,可以使用这些属性来记录系统设置或进程之间的信息交换.Android系统在启动过程时会按序从以下几个文件中加载系统属 ...

  7. Android开发之EditText属性详解

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  8. android控件的属性

    android控件的属性 本节描述android空间的位置,内容等相关属性及属性的含义 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 ( ...

  9. 【转】 Android开发之EditText属性详解

    原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...

随机推荐

  1. 【一个比较bug free的二分写法】

    lower_bound: [l, r)区间内大于等于val的第一个位置 int lower_bound(int l, int r, int val){ while(l < r){ ); if(a ...

  2. py2exe error: [Errno 2] No such file or directory: 'MSVCP90.dll'

    使用 python setup.py py2exe 打包时出现 py2exe error: [Errno 2] No such file or directory: 'MSVCP90.dll' 解决方 ...

  3. git repo gerrit 的关系

    Git作为一个版本控制工具,功能很强大,新建分支,切换分支都很快,小团队用Git就能很好地管理好了,但如果是Android系统如此庞大的工程呢,我们知道全套Android源码是很大很大的,目录结构也很 ...

  4. VIM的修炼等级

    用vim 快两年了 看过教程也不少,总的来说还是得自己多练习,当自己觉得有需要的时候,再添加功能.这里分享个看过的最好的教程,出自贴吧的某个朋友,写的很好 零 学会盲打 壹 配置文件先从最简开始,在 ...

  5. linux内核之系统调用nanosleep与pause()

    nanosleep()使得进程进入睡眠状态,指定时候后唤醒进程,sleep()基于其实现 asmlinkage long sys_nanosleep(struct timespec *rqtp, st ...

  6. LeetCode OJ--Multiply Strings **

    https://oj.leetcode.com/problems/multiply-strings/ 用字符串实现大数乘法,细节题,细节很多 class Solution { public: stri ...

  7. Codeforces 761E Dasha and Puzzle(构造)

    题目链接 Dasha and Puzzle 对于无解的情况:若存在一个点入度大于4,那么直接判断无解. 从根结点出发(假设根结点的深度为0), 深度为0的节点到深度为1的节点的这些边长度为2^30, ...

  8. HDFS写文件过程分析

    转自http://shiyanjun.cn/archives/942.html HDFS是一个分布式文件系统,在HDFS上写文件的过程与我们平时使用的单机文件系统非常不同,从宏观上来看,在HDFS文件 ...

  9. js 日期计算星座 根据生日的月份和日期,一行代码计算星座的js小函数(转)

    本博客根据 开源中国作者清风徐不来 的文章 根据生日的月份和日期,一行代码计算星座的js小函数(转) 原文出自CSDN 无心的专栏 的文章,知识产权归原文作者所有! 点击查看原文:js 日期计算星座

  10. 蒙特卡洛法MATLAB

    %%unifrnd函数的使用 %unifrnd函数可以创建随机的连续均匀分布的数组,一般式为R=unifrnd(A,B); %A和B是标量或者相同维数的行向量或者列向量.R=unifrnd(A,B,[ ...