1. activity_maim.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <ScrollView
android:id="@+id/view1"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="insideOverlay" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView> <ScrollView
android:id="@+id/view2"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="insideInset" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView> <ScrollView
android:id="@+id/view3"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="outsideOverlay" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView> <ScrollView
android:id="@+id/view4"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="outsideInset" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView> </LinearLayout>

2. 运行结果截图:

3. 相关说明:

android:scrollbarStyle可以定义滚动条的样式和位置,可选值有insideOverlay、insideInset、outsideOverlay、outsideInset四种。
其中inside和outside分别表示是否在view的padding区域内,overlay和inset表示覆盖在view上或是插在view后面,所以四种值分别表示:
insideOverlay:默认值,表示在padding区域内并且覆盖在view上
insideInset表示在padding区域内并且插入在view后面
outsideOverlay:表示在padding区域外并且覆盖在view上,推荐这个
outsideInset:表示在padding区域外并且插入在view后面

本文转自:http://blog.csdn.net/duanyipeng/article/details/8591575

Android-关于android:scrollbarStyle属性的更多相关文章

  1. android:scrollbarStyle属性及滚动条和分割线覆盖问题

    android:scrollbarStyle可以定义滚动条的样式和位置,可选值有insideOverlay.insideInset.outsideOverlay.outsideInset四种. 其中i ...

  2. android中xml tools属性详解

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

  3. Android入门(六):Android控件布局属性全解

    第一类:属性值为true或falseandroid:layout_centerHrizontal 水平居中 (Hrizontal表示水平)android:layout_centerVertical 垂 ...

  4. Android读取自定义View属性

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

  5. android中xmlns:tools属性详解

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

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

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

  7. android布局 及 布局属性

    Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> ...

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

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

  9. Android开发之EditText属性详解

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

随机推荐

  1. Unity Editor not displaying Android textures properly

    最近入门学习shader,语法倒没什么,有一个奇怪的问题,如果把编译平台从pc转换为android模式的话,如果你的shader 带 Normal Mapping 的 话,效果和android上的真机 ...

  2. Volatile 说明

    Java™ 语言包含两种内在的同步机制:同步块(或方法)和 volatile 变量.这两种机制的提出都是为了实现代码线程的安全性.其中 Volatile 变量的同步性较差(但有时它更简单并且开销更低) ...

  3. Javascrip操作json方法

    var str1 = '{ "name": "cxh", "sex": "man" }'; var data=eval( ...

  4. JsRender系列demo(9)自定义函数

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  5. ASP.NET连接数据库并获取数据

    关键词:连接对象的用法SqlConnection,SqlCommand,SqlDataAdapter *数据访问方式的写法 工具/原料 VS SQL SERVER 2012 R2 方法/步骤1: 1. ...

  6. 关于fisher判别的一点理解

    最近一个朋友问这方面的一些问题,其实之前也就很粗略的看了下fisher,真正帮别人解答问题的时候才知道原来自己也有很多东西不懂.下面小结下自己对fisher判别的理解: 其实fisher和PCA差不多 ...

  7. 【mongoDB运维篇②】备份与恢复(导入与导出)

    导入/导出可以操作的是本地的mongodb服务器,也可以是远程的服务器 所以,都有如下通用选项: -h host 主机 --port port 端口 -u username 用户名 -p passwd ...

  8. springmvc环境的搭建

    最近应公司要求,用了2天时间学了springmvc的搭建,就简单总结一下: springmvc和struts2的比较,因为我是学过struts的,它们都是基于mvc模式而设计的web层框架 它们最大的 ...

  9. python logging 学习笔记

    logging.basicConfig函数各参数: filename: 指定日志文件名 filemode: 和file函数意义相同,指定日志文件的打开模式,'w'或'a' format: 指定输出的格 ...

  10. linux系统启动级别

    linux运行级别 以管理员身份进入Linux,修改文件:/etc/inittab 找到"id:5:initdefault:"其中的5就是X-window,为默认的运行级别 lin ...