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. list dict 性能测试

    from random import randint def load_list_data(total_nums, target_nums): """ 从文件中读取数据, ...

  2. 利用ROS内建SLAM建立地图

    ros中建地图方式有两种: 首先1.首先下载hector_slam包到你工作空间的src下 命令: cd ~/catkin/src git clone https://github.com/tu-da ...

  3. eclipse在linux環境下安裝注意事项

    文件如果安装在非home文件夹下必须为eclipse授权 sudo chmod -R 777 /usr/tools/eclipse

  4. springBoot 环境

    环境约束 jdk1.8:Spring Boot 推荐jdk1.7及以上:maven3.x:maven 3.3以上版本:Apache Maven 3.3.9.IntelliJIDEA2017:Intel ...

  5. .NET下XML文件的读写

    一.前言: XML是微软.Net战略的一个重要组成部分,而且它可谓是XML Web服务的基石,所以掌握.Net框架下的XML技术自然显得非常重要了.本文将指导大家如何运用C#语言完成.Net框架下的X ...

  6. asp.net core 2.1 将控制器抽离到类库中

    startup.cs的ConfigureServices中添加: public void ConfigureServices(IServiceCollection services) { var ma ...

  7. TopCoder SRM 682 Div1 Problem 450 SuccessfulMerger (环套树 + 分类讨论)

    题意  给定一个$n$个点$n$条边的无向图,现在要把这个图进行若干次操作,并选择一个点作为首都. 要求除首都外的任意两个点$u$, $v$,从$u$走到$v$必须经过这个首都. 操作为合并两个相邻的 ...

  8. 最短Hamilton路径

    题目描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径. Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每 ...

  9. vue.js移动端app实战2

    貌似有部分人要求写的更详细,这里多写一点vuel-cli基础的配置 什么是vue-cli? 官方的解释是:A simple CLI for scaffolding Vue.js projects,简单 ...

  10. 2016北京集训测试赛(十四)Problem A: 股神小L

    Solution 考虑怎么卖最赚钱: 肯定是只卖不买啊(笑) 虽然说上面的想法很扯淡, 但它确实能给我们提供一种思路, 我们能不买就不买; 要买的时候就买最便宜的. 我们用一个优先队列来维护股票的价格 ...