android 控件 卷轴视图(ScrollView)

来源:互联网 发布:nginx url 限制ip 编辑:程序博客网 时间:2024/04/29 04:57

1、继承关系和子类:


2、定义:

ScrollView滚动视图是指当拥有很多内容,屏幕显示不完时,需要通过滚动跳来显示的视图。ScrollView只支持垂直滚动

注,ScrollView不要和 ListView结合使用,ListView会自己自己的垂直滚动。

3、XML重要属性:


4、重要方法:


5、实战:

布局文件 

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:scrollbars="vertical" >    <LinearLayout        android:id="@+id/container"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:orientation="vertical" >        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="200dp"            android:src="@drawable/ic_launcher" />    </LinearLayout></ScrollView>

参考1:http://developer.android.com/intl/zh-cn/reference/android/widget/ScrollView.html
参考2:http://android.tgbus.com/Android/tutorial/201107/360548.shtml
0 0