1.垂直滚动控件ScrollView。
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- 这里要显示的View-->
</LinearLayout>
</ScrollView>
2.水平滚动控件HorizontalScrollView。
gallery被google弃用后被HorizontalScrollView替代。感觉UI显示上的确和gallery相似。
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- 这里放要显示的View-->
</LinearLayout>
</HorizontalScrollView>
两个滚动控件在xml里定义是,里面都需要镶嵌一个相对应方向的
LinearLayout布局。具体要显示的View可以在LinearLayout里放置。