如何设置标签视图滚动?

时间:2010-03-22 14:13:08

标签: android scroll

我已设法为我的应用设置标签式视图(喔!)

并为UI提供以下xml

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
    />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    />
</LinearLayout>

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">
    <Spinner android:id="@+id/areaSpinner"
             android:layout_width="fill_parent"
             android:layout_height="@dimen/one_row"
     />
     <Spinner android:id="@+id/cragSpinner"
              android:layout_width="fill_parent"
              android:layout_height="@dimen/one_row"
     />
     <Spinner android:id="@+id/routeSpinner"
              android:layout_width="fill_parent"
              android:layout_height="@dimen/one_row"
     />
     <DatePicker android:id="@+id/dateClimbed"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
     />
     <Spinner android:id="@+id/styleSpinner"
              android:layout_width="fill_parent"
              android:layout_height="@dimen/one_row"
     />
     <Spinner android:id="@+id/detailsSpinner"
              android:layout_width="fill_parent"
              android:layout_height="@dimen/one_row"
     />
     <TextView android:id="@+id/climbNotes"
             android:layout_width="fill_parent"
             android:layout_height="@dimen/three_row"
   />
</LinearLayout>

但我似乎无法向下滚动以查看表格的其余部分(切断其中一个旋转器,为什么会这样?我该如何解决?

2 个答案:

答案 0 :(得分:3)

我遇到了同样的问题!

我所做的是将一个ScrollView插入到TabHost标签“内部”的第一个XML文件中,如下所示:

<TabHost>
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout>

......剩下的东西

</LinearLayout>
</ScrollView>
</TabHost>

希望这有帮助!

答案 1 :(得分:2)

您是否在ScrollView

中有标签的内容?

编辑:修复XML格式后,我可以看到您的第二个XML文件。您需要在ScrollView中将第二个布局中的所有内容包装起来。

第二次编辑:尝试编辑第二个XML文件,使其遵循以下模式:

<ScrollView>
   <LinearLayout>
     ... all your other stuff
   </LinearLayout>
</ScrollView>