ScrollView垂直滚动和HorizontalScrollView水平滚动。
滚动视图(为控件或者布局添加滚动条):屏幕显示不完时,可通过滚动来显示视图。
ScrollView垂直滚动和HorizontalScrollView水平滚动。
这两个控件只能有一个孩子,它并不是传统意义上的容器。
activity_main.xml文件代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/picture01" />
<!-- picture01最好是一个操作屏幕的大图片 -->
</ScrollView>
</HorizontalScrollView>
</RelativeLayout>