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. BestCoder 2nd Anniversary/HDU 5719 姿势

    Arrange Accepts: 221 Submissions: 1401 Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/2 ...

  2. 【转】 #define用法详解

    #define用法详解   1.#define 的作用 在C或C++语言源程序中允许用一个标识符来表示一个字符串,称为“宏”.被定义为“宏”的标识符称为“宏名”.在编译预处理时,对程序中所有出现的“宏 ...

  3. 存储过程代码生成器Stored Procedure Generator

    原文发布时间为:2010-10-26 -- 来源于本人的百度文章 [由搬家工具导入] Stored Procedure Generator (for SQL Server 2000/2005) htt ...

  4. linux下的用户组管理

    用户组管理分两类 如果赋给组什么权限,那么组员就会有什么权限 1.私有组 在创建新用户的时候,就要为用户指定组.如果没有指定,就会默认创建一个与用户名相同的用户组,这个用户组只有该用户一个用户,就被称 ...

  5. linux下的用户管理(二)

    创建帐号: 手工创建-> 1.在/etc/passwd中添加一条记录 2.创建用户主目录 3.在用户的家目录下设置默认的配置文件 4.设置用户初始口令 命令创建-> useradd或add ...

  6. [LeetCode] Search in Rotated Sorted Array II 二分搜索

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...

  7. Spring Boot学习——统一异常处理

    本随笔记录使用Spring Boot统一处理异常. 本文实例是从数据库中根据ID查询学生信息,要求学生的年龄在14——20岁之间.小于14岁,提示“你可能在上初中”:大于20岁,提示“呢可能在上大学” ...

  8. C#原生加密方法: System.Security.Cryptography.CryptoStream DataSet加密解密

    采用16位密钥形式加密,把数据 dataset或文本转换为二进制流,然后进行加密解密.代码如下: using System; using System.Collections.Generic; usi ...

  9. Cryptography I 学习笔记 --- 信息完整性

    1. ECBC-MAC,需要一对密钥k与k1,然后将明文分组,用cbc模式对明文分块加密,将最后的密文块再用k1进行加密,即可得到结果 2. NMAC,需要一对密钥k与k1,然后将明文分组,用k加密第 ...

  10. HDU 6225.Little Boxes-大数加法 (2017ACM/ICPC亚洲区沈阳站-重现赛(感谢东北大学))

    整理代码... Little Boxes Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/O ...