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. winform窗口打开后文本框的默认焦点设置

    原文:http://blog.csdn.net/kongwei521/article/details/6871411 winform窗口打开后文本框的默认焦点设置,进入窗口后默认聚焦到某个文本框,两种 ...

  2. 中小企业 IT 运维福利:快速构建 on-call 机制

    大多 IT 运营支撑同学都有过深夜业务应用突然故障的经历,监控系统准确告警,但是白天筋疲力尽的运维同学在熟睡中,经常会遗漏告警提醒:往往是接到主管电话(用户投诉了)才处理.有什么办法解决该问题呢?大多 ...

  3. BZOJ 3129 SDOI2013 方程

    如果没有限制,答案直接用隔板法C(m-1,n-1) 对于>=x的限制,我们直接在对应位置先放上x-1即可,即m=m-(x-1) 对于<=x的限制,由于限制很小我们可以利用容斥原理将它转化为 ...

  4. lintcode:Subtree 子树

    题目: 子树 有两个不同大小的二叉树: T1 有上百万的节点: T2 有好几百的节点.请设计一种算法,判定 T2 是否为 T1的子树. 样例 下面的例子中 T2 是 T1 的子树: 1 3 / \ / ...

  5. 含有特殊字符的JSON串解析方法

    工具方法:public static <T> T parseJsonString(String json,Class<T> classType){ ObjectMapper m ...

  6. HDU5086——Revenge of Segment Tree(BestCoder Round #16)

    Revenge of Segment Tree Problem DescriptionIn computer science, a segment tree is a tree data struct ...

  7. 【Android多屏适配】动态改变Listview item高度

    在ListView的Adapter中去直接获取传入View的LayoutParams是会报空指针异常的,唯一的方法是在xml中嵌套布局一层LinearLayout <?xml version=& ...

  8. cocos2dx开发笔记

    1.帧动画:SpriteTest=>SpriteAnimationSplit 2.sourceinsight显示代码行 option->document option->editin ...

  9. hive环境的搭建

    hive 默认用的是derby数据库存储源数据,在这改为 mysql来存储: 1.hive和关系数据库的对照关系 hive 所要查询的数据保存在HDFS中: hive 中的数据库和表对应HDFS中的文 ...

  10. When you’re nearly 40 and unmarried, and you realize you’re going to be okay

    https://medium.com/the-gathering-kind/when-you-re-nearly-40-and-unmarried-and-you-realize-you-re-goi ...