【发布时间】:2011-08-28 21:22:53
【问题描述】:
在 Android 中,我尝试使用此 xml 来获取 LinearLayout 旁边的 TableLayout。但我无法让它工作。 TableLayout 总是占据屏幕的整个宽度。如何让它与 LinearLayout 共享屏幕宽度?
<LinearLayout android:layout_width="fill_parent" android:weightSum="1" android:layout_height="wrap_content" android:orientation="horizontal">
<TableLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
<TableRow>
<TextView android:text="Name1:" />
<TextView android:text="Value1" />
</TableRow>
<TableRow>
<TextView android:text="Name2:" />
<TextView android:text="Value2" />
</TableRow>
</TableLayout>
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5"></LinearLayout>
</LinearLayout>
【问题讨论】:
-
xml 工作正常,可以产生预期的结果
标签: android layout android-linearlayout tablelayout