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

最新文章

  1. [Spring] AOP, Aspect实例解析
  2. 服务器磁盘扩展卷时遭遇&ldquo;There is not enough space available on the disk(s) to complete this operation.&rdquo;错误
  3. [原] Android快速开发框架-AndroidFine,GitHub开源
  4. JS类的封装及实现代码
  5. php 读取文件的几种方法
  6. json2.js的用途(拯救IE)
  7. Android手机tcpdump抓包
  8. UICollectionViewLayout
  9. richTextBox插入表格 完整版
  10. mysql死锁问题分析(转)
  11. 浏览器扩展系列————异步可插入协议(pluggable protocol)的实现
  12. 学习MVC之租房网站(五)-权限、角色、用户管理
  13. cips2016+学习笔记︱NLP中的消岐方法总结(词典、有监督、半监督)
  14. 学习 javascript (一)javascript 简介
  15. laravel5.4 向闭合函数内部传递参数
  16. excel 中批量生成mysql的脚本
  17. SNF开发平台WinForm-表单验证控件-通用
  18. Math对象属性
  19. sqlserver判断字段是否存在更改字段
  20. JAVA框架Struts2 servlet API

热门文章

  1. C++中的const关键字
  2. Lua基础 函数(一)
  3. cf div2 235 D
  4. POJ 1795
  5. [LeetCode]Link List Cycle II
  6. Android开发--使用真机进行USB调试程序
  7. Git PHP提交
  8. ZOJ 1642 Match for Bonus (DP)
  9. truncate、drop、delete区别
  10. lintcode :前序遍历和中序遍历树构造二叉树