在TableLayout中使用EditView的Android文本剪辑问题

时间:2010-11-15 12:06:32

标签: android text tablelayout clipping

我有一个小剪辑问题,我无法使用TableRow中的EditText视图解决。无论我尝试什么,EditText视图都被剪裁(附加截图),或者,如果我将shrinkColumns设置为0或1,标签文本将消失(并且EditText视图占据整个宽度)。布局如下:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:padding="10dip">

  <TableLayout android:orientation="vertical"
  android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TableRow android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content">

      <TextView android:paddingRight="10dip" android:layout_column="1"
      android:text="Label Text" />
      <EditText android:text="Very long text that makes the text view go on clipping frenzy"
      android:layout_width="wrap_content" android:layout_height="wrap_content" />

    </TableRow>

  </TableLayout>

</LinearLayout>

我在QVGA和HVGA上运行的2.2仿真器,2.1上的HTC Hero和2.1上的Wildfire上尝试过。我也玩过clipToPadding属性,这在我的情况下似乎没什么帮助。如果我使用长文本设置提示属性并将文本值保留为空,则会出现相同的问题。

由于我没有做任何特别复杂的事情,我怀疑我身边有一个简单的错误。任何想法,提示或建议都受到高度赞赏。

干杯!

alt text

2 个答案:

答案 0 :(得分:7)

在TableLayout上设置android:shrinkColumns =“1”,并从TextView中删除android:layout_column =“1”。

答案 1 :(得分:1)

将android:layout_weight =“1”添加到EditText中,需要一段时间才能解决它..........

但不知道它的原因.......