views:

921

answers:

2

I have managed to set up a tabbed view for my app (woo!)

and have the following xml for the UI

<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>

yet am seemingly unable to scroll down to see the rest of the form (cuts off at one of the spinners, why is this? and how do i fix it?

+2  A: 

Do you have the contents of the tab in a ScrollView?

Edit: After I fixed your XML formatting I could see your 2nd XML file. You need to wrap everything in that 2nd layout in a ScrollView.

2nd Edit: Try editing your 2nd XML file so that it follows this pattern:

<ScrollView>
   <LinearLayout>
     ... all your other stuff
   </LinearLayout>
</ScrollView>
mbaird
no, how do i do that?the xml above is exactly what I am using at present
DrogoNevets
See my 2nd Edit to my answer above.
mbaird
didnt work, i now, instead of seeing loads of stuff, only get the first spinner, and if i invert it so<linearLayout><scrollView>...it crashes
DrogoNevets
set android:layout_width="fill_parent" android:layout_height="fill_parent" for both the scrollview and linearlayout.
Pentium10
You can't have multiple children in a <ScrollView>. Try this: <LinearLayout><ScrollView><LinearLayout>. You are setting android:layout_width="fill_parent" android:layout_height="fill_parent" on all these right?
mbaird
A: 

I had the same problem!

What I did was insert a ScrollView into the first XML file just "inside" the TabHost tags, like so:

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

... the rest of your stuff

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

Hope this helps!

Kimee