我想在我的应用程序中实现这种类型的视图。. .
data1 hello hi
data2 hello2 hi
data3 hi Hello
我想知道,哪一个是最好的设置方法??表布局或任何其他线性布局。相对布局???我还希望 xml 代码设置此布局。. 谢谢。
我想在我的应用程序中实现这种类型的视图。. .
data1 hello hi
data2 hello2 hi
data3 hi Hello
我想知道,哪一个是最好的设置方法??表布局或任何其他线性布局。相对布局???我还希望 xml 代码设置此布局。. 谢谢。
试试这个,
<?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
最好是你的情况。示例:http ://www.tutorialforandroid.com/2008/12/simple-tablelayout-in-android.html
@note:只是不要那么懒惰地谷歌它!