【推荐下载】Android控件之ScrollView(scrollbarStyle)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
cornersandroid:radius=“6dp”//shape
3,ScrollView中ScrollBar的style该属性可以通过xml文件配置
如:android:scrollbar
也可以通过java代码配
置:findViewById(R.id.view3).setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
3insideInset:该ScrollBar显示在padding区域里面,增加了控件的
padding区域,该ScrollBar不会和视图的内容重叠.
4insideOverlay:该ScrollBar显示在内容区域里面,不会增加了控件的
padding区域,该ScrollBar以半透明的样式覆盖在视图(view)的内容上.
android:text=“@string/scrollbar_3_text”android:textColor=“#000000”/
/ScrollViewScrollViewandroid:id=“@+id/view3”
android:layout_width=“100dip”android:layout_height=“120dip”
android:scrollbarTrackVertical=“@drawable/scrollbar_vertical_track”
android:scrollbarThumbVertical=“@drawable/scrollbar_vertical_thumb”
android:scrollbarSize=“12dip”....../ScrollViewscrollbar_vertical_track.xml:
大致可以设置4个属性:
1outsideInset:该ScrollBar显示在视图(view)的边缘,增加了view的
padding.如果可能的话,该ScrollBar仅仅覆盖这个view的背景.
2outsideOverlay:该ScrollBar显示在视图(view)的边缘,不增加view的
padding,该ScrollBar将被半透明覆盖
android:background=“#00FF00”android:paddingRight=“12dip”
android:scrollbarTextViewandroid:layout_width=“match_parent”
android:layout_height=“wrap_content”android:background=“#60AA60”
1,普通样式的ScrollBar(默认样式),如下图所示:
2,下面再来看一个比较绚的效果:
实现如下:
布局:
ScrollViewxmlns:android=“schemas.android/apk/res/android”
android:layout_width=“match_parent”android:layout_height=“wrap_content”
android:background=“#00FF00”android:paddingRight=“12dip”
android:scrollbarTextViewandroid:layout_width=“match_parent”
android:layout_height=“wrap_content”android:background=“#60AA60”
android:text=“@string/scrollbar_3_text”android:textColor=“#000000”/
/ScrollView/LinearLayoutLinearLayout
android:layout_width=“match_parent”android:layout_height=“wrap_content”
android:layout_width=“match_parent”android:layout_height=“wrap_content”
android:orientation=“horizontal”ScrollView
android:layout_width=“100dip”andrlns:android=“schemas.android/apk/res/android”gradient
android:startColor=“#505050”android:endColor=“#C0C0C0”android:angle=“0”/
cornersandroid:radius=“0dp”//shape
scrollbar_vertical_thumb.xml:shape
xmlns:android=“schemas.android/apk/res/android”gradient
android:startColor=“#3333FF”android:endColor=“#8080FF”android:angle=“0”/
android:orientation=“horizontal”ScrollViewandroid:id=“@+id/view4”
Android控件之ScrollView(scrollbarStyle)
2012/08/1529991ScrollView,当内容超过了整个屏幕或者容器的时候需要
使用ScrollView
并且ScrollView的直接子元素只能有一个.
ScrollView的用法非常简单,这里主要说的是ScrollView中ScrollBar的用法
下面通过例子来分析:
LinearLayoutxmlns:android=“schemas.android/apk/res/android”
android:layout_width=“match_parent”android:layout_height=“match_parent”
android:orientation=“vertical”LinearLayout
相关文档
最新文档