1

このタイプのビューをアプリケーションに実装したいと考えています。. .

data1    hello   hi 
data2    hello2  hi
data3    hi      Hello

知りたいのですが、どちらが設定するのに最適な方法ですか?? TableLayout またはその他の linearLayout.RelativeLayout ??? また、xml コードでこのレイアウトを設定したいと考えています。. ありがとう。

4

2 に答える 2

4

これを試して、

<?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>
于 2011-10-08T06:03:49.530 に答える
2

TableLayoutあなたの場合は好ましいです。例: http://www.tutorialforandroid.com/2008/12/simple-tablelayout-in-android.html

@note: Google で検索するのを怠らないでください。

于 2011-10-08T05:48:28.950 に答える