【问题标题】:TableLayout formatting loss after device rotation设备旋转后的 TableLayout 格式丢失
【发布时间】:2011-03-03 16:03:34
【问题描述】:

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

旋转前:

before rotation http://dl.dropbox.com/u/334957/normal_from_portrait.png

旋转后:

after rotation 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> 

谢谢!

【问题讨论】:

  • 今天在 2.2 Nexus One 上进行了检查,没有这个问题。可能是 Google 修复的

标签: android layout rotation orientation tablelayout


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-24
  • 2017-05-29
  • 2013-12-21
  • 2014-01-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多