我想在我的应用程序中实现这种类型的视图。 。 。如何在android中设置这个tableLayout?
data1 hello hi
data2 hello2 hi
data3 hi Hello
我想知道,哪一个是设置它的最好方法? TableLayout oranyother linearLayout.RelativeLayout ??? 我也想要xml代码来设置这个布局。 。 谢谢。
我想在我的应用程序中实现这种类型的视图。 。 。如何在android中设置这个tableLayout?
data1 hello hi
data2 hello2 hi
data3 hi Hello
我想知道,哪一个是设置它的最好方法? TableLayout oranyother linearLayout.RelativeLayout ??? 我也想要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:只是不要这么懒得Google!
亲爱的我已经在谷歌搜索。但我想要这样的布局,以适应屏幕的宽度。布局应该是出色的。这就是为什么我提出了问题。我仍然没有得到正确的答案。因为我想要适合设备屏幕的布局。 –
设置'fill_parent'来填充整个屏幕的布局 –
好的不错。有用。现在,如果我想给更多大小的第二列,那么我应该把weightSum给4,第二个textview权重2吧? –
是的,我认为你知道它是如何工作的。 :) –
是的,我明白了。谢谢。 –