views:

821

answers:

1

I am having a table defined in XML file, which currently set to Scroll vertically. But i also want it scroll horizontally as required.

Here is the code of XML in use

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:scrollbars="vertical" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent">

    <TableLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:stretchColumns="0,1,2"
        android:id="@+id/tLayout"
        android:scrollbars="vertical"
        >   
        <TableRow
            android:layout_width="fill_parent">
            <TextView
                android:padding="3dip"
                android:gravity="left"
                android:text="Name"
                />
            <TextView
                android:padding="3dip"
                android:gravity="left"
                android:text="Address"
                />
            <TextView
                android:padding="3dip"
                android:gravity="left"
                android:text="Age"
                />
        </TableRow>
    </TableLayout>
</ScrollView>
+1  A: 

Remove android:scrollbars="vertical" or change to android:scrollbars="horizontal|vertical" should do the magic

WarrenFaith
Not working It was surprise to find that removing the android:scrollbars(both) tags does not affect output all. More to say, Horizontal scrolling is just not working, even when i just used 'horizontal' as the value on both tags.
Amit