1

在设备从任一方向旋转后,我看到 TableLayout 出现一个奇怪的问题。如果您以纵向或横向模式加载视图,则表格加载正常。但是,一旦您旋转设备,这些列就会折叠以适合它们的宽度。我希望在旋转后,列仍会拉伸以适应屏幕的宽度。关于可以做些什么来解决这个问题的任何想法?屏幕截图和布局代码如下。

旋转前:

旋转前 http://dl.dropbox.com/u/334957/normal_from_portrait.png

旋转后:

旋转后 http://dl.dropbox.com/u/334957/after_rotate_portrait.png

表布局:

    <TableLayout android:id="@+id/dataTable"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
    android:layout_below="@id/chart"
 android:stretchColumns="*"
    android:shrinkColumns="*"
    android:padding="6dip"
 >  
 </TableLayout>

表行:

    <TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
    android:layout_height="fill_parent">
          <TextView android:id="@+id/col1"
          android:layout_marginRight="2dip"
          android:textColorLink="#FF21759b"
          android:text="Column 1"
          android:padding="4dip"
          android:textColor="#FF464646"/>
          <TextView android:id="@+id/col2" android:text="Column 2"
          android:textColor="#FF464646"
          android:padding="4dip"/>
</TableRow> 

谢谢!

4

1 回答 1

0

我认为这与在 Android 1.6 和 2.1 上裁剪的 TableLayout 中的按钮相同(但不是在 1.5 或 2.2 上)

于 2010-08-30T02:35:43.793 回答