【发布时间】:2012-05-02 18:12:42
【问题描述】:
我在执行以下操作时遇到问题:http://imageshack.us/photo/my-images/824/examplehm.png/
我的 xml 代码在一行中显示 3 列,但我想要 2 列,第二列必须分成两个水平部分。
我的 .xml:
<?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="fill_parent" >
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
<TableRow>
<ImageView android:id="@+id/imagen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="2dip"
android:paddingRight="5dip" />
<TextView android:id="@+id/cabecera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="12px" />
<TextView android:id="@+id/descripcion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="normal"
android:textSize="10px" />
</TableRow>
</TableLayout>
有人可以帮助我吗?
谢谢。
【问题讨论】:
-
看看Android Tricks #1 blogpost - 它会告诉你两种方法:一种好,一种……好吧,不太好。 :)
-
谢谢@MH。我做了指南显示的 2 种方式,但我的结果不好:imageshack.us/photo/my-images/137/listanofunciona1.png 也许我必须将 xml 分成两个文件,其中一个与 ListView,另一个与其余代码...在链接中你可以只看到数据库查询的三个结果之一。显示的行仅包含图像和两个文本之一。当我尝试使用指南的 RelativeLayout 示例时会发生这种情况,当我尝试使用第一个示例时,我的应用程序不显示行:(
-
@MH。我看到指南的第二种方式有效!但在一个小空间中显示 3 行。我拉出了您可以在链接中看到的第一行,然后......惊喜!另外两行在那里。现在我的问题是如何做更大的空间来显示所有数据库查询结果并显示第三个文本。我还在工作……
标签: android android-tablelayout tablerow