Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TableLayout does not scroll vertically

Thanks in advance for any help. I am very new to Android.

Here's my problem. I am using a TableLayout to display editable fields. There are about twenty rows to display.

The rows overflow the screen on smaller devices. I need the View to allow the user to scroll up and down. What am I missing?

Tried wrapping the TableLayout in a ScrollView, didn't work.

like image 238
Odyssey Avatar asked Apr 05 '12 21:04

Odyssey


People also ask

How can I make my layout scroll vertically in Android?

Vertical scroll view going to scroll its child view in Vertical direction so we have created Linear layout as a child for Vertical scroll view and added child for linear layout.

Can scroll vertically Android?

In Android, a ScrollView is a view group that is used to make vertically scrollable views. A scroll view contains a single direct child only. In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it.


1 Answers

put your TableLayout inside ScrollView

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <TableLayout
            android:id="@+id/tableLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

            </TableRow>



        </TableLayout>

    </ScrollView>
like image 99
Ravi1187342 Avatar answered Sep 27 '22 19:09

Ravi1187342