现在的位置: 首页 > 综合 > 正文

Android ApiDemos示例解析(188):Views->ScrollBars->1.Basic

2013年01月28日 ⁄ 综合 ⁄ 共 915字 ⁄ 字号 评论关闭

本例介绍了ScrollView 的基本用法,ScrollView 允许用户滚动屏幕以显示大于屏幕的内容,ScrollView 为FrameLayout的子类,因此一般只在ScrollView显示一个子Layout,通常使用方向为垂直方向的LinearLayout作为ScrollView的子View。 ScrollView只支持垂直滚动。

在介绍Layout时已经有不少关于ScrollView 的例子:

<ScrollView xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<LinearLayout
android:orientation=”vertical”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<TextView
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/scrollbar_1_text”/>

…

<TextView
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/scrollbar_1_text”/>
</LinearLayout>
</ScrollView>

 

抱歉!评论已关闭.