开发者

How can we set content of a column to wrap in Table layout

开发者 https://www.devze.com 2022-12-21 12:51 出处:网络
I am trying out this table layout in which there are three columns, each column utilizing the maximum space as they could (using strechColumn tag). Now when a column gets content which is too long, th

I am trying out this table layout in which there are three columns, each column utilizing the maximum space as they could (using strechColumn tag). Now when a column gets content which is too long, then table layout jumps off the screen.

How can I set the content of a column to wrap, so that table layout doesn't jump off the screen.

here is the XML code for table layout i used

<?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"
        an开发者_如何学编程droid: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>


There is a corresponding android:shrinkColumns that you can specify in your TableLayout.

0

精彩评论

暂无评论...
验证码 换一张
取 消