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. redis学习(三)五种数据结构

    Redis支持五种数据类型:string(字符串),hash(哈希),list(列表),set(集合)及zset(sorted set:有序集合). 1.string string类型是Redis最基 ...

  2. Java EE 学习(7):IDEA + maven + spring 搭建 web(3)- 配置数据库

    参考: https://my.oschina.net/gaussik/blog/513444 注:在阅读本文前,请先阅读: Java EE 学习(5):IDEA + maven + spring 搭建 ...

  3. HAOI2008题解

    又来写题解辣-然而并不太清楚题目排列情况...不管辣先写起来- T1:[bzoj1041] 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1 ...

  4. Python之访问set

    dict的作用是建立一组 key 和一组 value 的映射关系,dict的key是不能重复的. 有的时候,我们只想要 dict 的 key,不关心 key 对应的 value,目的就是保证这个集合的 ...

  5. 【HDOJ5517】Triple(二维BIT)

    题意:给你n个二元组<a,b>, m个三元组<c,d,e>. 如果d = e,那么<a,c,d>会组成一个新的三元组集合G. 问G中有多少个三元组在凸点.(没有其它 ...

  6. [LeetCode] Compare Version Numbers 字符串操作

    Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 &l ...

  7. [LeetCode] Scramble String 字符串 dp

    Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrin ...

  8. sgu 275 To xor or not to xor 线性基 最大异或和

    题目链接 题意 给定\(n\)个数,取其中的一个子集,使得异或和最大,求该最大的异或和. 思路 先求得线性基. 则求原\(n\)个数的所有子集的最大异或和便可转化成求其线性基的子集的最大异或和. 因为 ...

  9. RSTP介绍

    1. 介绍 RSTP(Rapid Spanning Tree Protocol),快速生成树协议,标准为802.1w(已合入802.1D-2004)RSTP是对STP技术的修改和补充,最大特点就是快速 ...

  10. vim的语法高亮及配置文件说明

    本文主要针对那些刚刚入门的菜鸟,老手请自动忽略,谢谢. 一.安装vim: sudo pacman -S vim 随后根据提示输入超级用户密码即可完成安装 二.配置自己的语法高亮文件,主要是修改-/.v ...