开发者

How to set this tableLayout in android?

I want to Implement this type of View in My Application. . .

data1开发者_C百科    hello   hi 
data2    hello2  hi
data3    hi      Hello

I want to know, which one is the best way to set it ?? TableLayout oranyother linearLayout.RelativeLayout ??? I also want the xml code to set this layout. . Thanks.


Try this,

<?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">
    <TableLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TableRow android:weightSum="3">
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
        </TableRow>

        <TableRow android:weightSum="3">
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
        </TableRow>

        <TableRow android:weightSum="3">
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
            <TextView android:layout_weight="1" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="hello" />
        </TableRow>
    </TableLayout>
</LinearLayout>


TableLayout is preferrable is your case. Example: http://www.tutorialforandroid.com/2008/12/simple-tablelayout-in-android.html

@note: just don't be so lazy to Google it!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜