一.滚动视图ScrollView:
1.说明:
由于手机屏幕高度有限,所以如果面对组件要显示多组信息的时候,
ScrollView视图(滚动视图)可以有效的安排这些组件,浏览的时
可以自动的进行滚屏的操作。
2.定义:
java.lang.Object
|-android.view.View
|-android.view.ViewGroup
|-android.widget.FrameLayout
|-android.widget.ScrollView
3.原理:
滚动视图的使用也各个布局管理器的操作形式类似。唯一不同的是,
所有的布局管理器中,可以包含多个组件,而滚动视图里只能有一个
组件,所以所谓的滚动视图指的就是提供一个专门的容器,这个容器里面可以
装下多余屏幕宽度的组件,而后采用拖拽的方式显示所有在ScrollView中的组件。
main.xml配置:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="姓名:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="学号::" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="地址:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="电话:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ni" />
</LinearLayout>
</ScrollView>
1.说明:
由于手机屏幕高度有限,所以如果面对组件要显示多组信息的时候,
ScrollView视图(滚动视图)可以有效的安排这些组件,浏览的时
可以自动的进行滚屏的操作。
2.定义:
java.lang.Object
|-android.view.View
|-android.view.ViewGroup
|-android.widget.FrameLayout
|-android.widget.ScrollView
3.原理:
滚动视图的使用也各个布局管理器的操作形式类似。唯一不同的是,
所有的布局管理器中,可以包含多个组件,而滚动视图里只能有一个
组件,所以所谓的滚动视图指的就是提供一个专门的容器,这个容器里面可以
装下多余屏幕宽度的组件,而后采用拖拽的方式显示所有在ScrollView中的组件。
main.xml配置:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="姓名:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="学号::" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="地址:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="电话:" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ni" />
</LinearLayout>
</ScrollView>