How to set tab view to scroll?

I managed to set up a tab for my application (woo!)

and have the following xml for 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> 

but I can't seem to scroll down to see the rest of the form (cut off by one of the spinners, why is this? and how do I fix it?

+1
source share
2 answers

I had the same problem!

What I did was paste ScrollView into the first XML file, just β€œinside” the TabHost tags, for example:

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

... the rest of your stuff

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

Hope this helps!

+3
source

Do you have tab contents in ScrollView ?

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

2nd Edit: Try editing the second XML file to match this pattern:

 <ScrollView> <LinearLayout> ... all your other stuff </LinearLayout> </ScrollView> 
+2
source

Source: https://habr.com/ru/post/1416134/


All Articles