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