How to make a scrollable TableLayout?

Take a look at the XML code here, please:

<TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dip" xmlns:android="http://schemas.android.com/apk/res/android"> <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- Some stuff goes here --> /> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- Some stuff goes here --> /> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- Some stuff goes here --> /> </TableRow> </TableLayout> 

My code is much longer than me, but I just eliminated the unnecessary parts. The problem is that I want to scroll this TableLayout scroll to show all my stuff.

I tried putting this row in a TableLayout to make it scrollable:

 android:isScrollContainer="true" 

But he does NOT do this work. Is there any way?

+48
android scroll android-tablelayout
Jun 28 '11 at 22:15
source share
3 answers

Fix it all:

 <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="none" android:layout_weight="1"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> ... </ScrollView> 
+91
Jun 28 '11 at 10:19
source share

Technically, LinearLayout is not required in ScrollView:

 <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="none" android:layout_weight="1"> <TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dip" android:isScrollContainer="true"> <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content"> <--!Everything Else You Already Have--> </TableRow> </TableLayout> </ScrollView> 

As soon as you take up enough space in the ScrollView, the scroll effect is activated (like HTML TextArea, as soon as you have enough lines of text, the scroll is activated.)

You can also nest ScrollView, but again you won’t be able to feel the scroll effect until you get enough content in ScrollView.

+12
Aug 27 '14 at
source share

thanks mbauer, he solved my problem i place is ok

  • Tablelayout
  • TableRow with end (for column heading)
  • Scrollview
  • Linearlayout
  • x TableRow with end
  • end LinearLayout
  • end of scrollview
  • end TableLayout
0
Dec 26 '14 at 11:58
source share



All Articles