创建表 Android
<TableLayout android:layout_width="match_parent" android:id="@+id/tableLayout1" android:layout_height="wrap_content" android:stretchColumns="1">
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:text="my name is Tarzan and i lives in Amazon Jungle. I want an android phone." android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text="my name is Mowgly and i lives in Amazon Jungle. I want an android phone." android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</TableRow>
我有一个包含两列的表格,我在两列中都放置了 TextView。我拉伸了第二列。但是,当我在两个 TextView 中设置长文本时,表格会拉伸到手机的限制,所以我看不到。如果我使用 android:layout_width="fill_parent"
设置表格布局,它也是一样的。我该怎么办?
<TableLayout android:layout_width="match_parent" android:id="@+id/tableLayout1" android:layout_height="wrap_content" android:stretchColumns="1">
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:text="my name is Tarzan and i lives in Amazon Jungle. I want an android phone." android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text="my name is Mowgly and i lives in Amazon Jungle. I want an android phone." android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</TableRow>
I have a table with two columns and I put TextViews in both.. I stretch the second column.. but, when I set the long text in both TextViews, the table stretch over the limit of phone so I can't see that.. it just same if I set the table layout with android:layout_width="fill_parent"
.. what should I do?
android:maxWidth="100dip"
.. 在你的textView中添加这样的标签..android:maxWidth="100dip"
.. add such a tag in your textView..