我在使用 Android 布局时遇到问题。我要创建的内容类似于以下内容:
<table width="300px">
<tr>
<td span="2">test</td>
</tr>
<tr>
<td align="right">image1</td>
<td align="right">image2</td>
</tr>
</table>
除了我希望“image1”和 2 在一起。无论如何,
这是我在 Android 中使用的布局:
<?xml version="1.0" encoding="UTF-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow android:layout_gravity="left" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="left|center_vertical"
android:layout_span="2"
android:paddingRight="5dip"
android:textColor="#ffffffff"
android:textSize="13dip" />
</TableRow>
<TableRow android:layout_gravity="right" >
<ImageView
android:layout_width="50px"
android:layout_height="120px"
android:layout_column="1"
android:layout_marginLeft="15dip" />
<ImageView
android:layout_width="263px"
android:layout_height="150px"
android:layout_column="2"
android:layout_marginLeft="15dip" />
</TableRow>
</TableLayout>
我还尝试将 android:layout_gravity:"right" 放在 ImageViews 本身上,但什么也没做。
出于某种原因,这个 Android 布局总是缩进标签(它不跨越列),并且永远不会右对齐第二行中的任何内容。我不知道我做错了什么。这是安卓2.1。有人知道吗?