【发布时间】:2012-02-22 23:39:48
【问题描述】:
http://i.stack.imgur.com/4Irb3.png
点击以上链接查看屏幕截图。
好的,所以我在编辑我的 xml 布局以使该列表看起来不错时遇到了一些问题。基本上我希望每一行信息都填满整个列表行,这样你在每行之间看到的空白就不存在了。我已经尝试在 row.xml 和 main.xml 中操作多个不同的属性,但到目前为止没有任何效果。有人有什么建议吗?谢谢
行.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:orientation="horizontal">
<TextView android:id="@+id/position"
android:textColor="@color/white"
android:background="@color/black"
android:layout_width="20dip"
android:textSize="14dip"
android:gravity="center"
android:layout_height="fill_parent"/>
<TextView android:id="@+id/team_name"
android:textColor="#000000"
android:background="@color/grey"
android:gravity="center"
android:layout_width="70dip"
android:textSize="14dip"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView android:id="@+id/games_played"
android:textColor="#000000"
android:background="@color/cyan"
android:layout_width="5dip"
android:textSize="14dip"
android:gravity="center"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView android:id="@+id/points"
android:textColor="#000000"
android:background="@color/turquoise"
android:layout_width="5dip"
android:textSize="14dip"
android:gravity="center"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
main.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/white"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="Team"
android:background="@color/red"
android:textColor="@color/white"
android:gravity="right"
android:layout_width="wrap_content" />
<TextView
android:text="Games Played"
android:background="@color/red"
android:textColor="@color/white"
android:gravity="center"
android:layout_width="wrap_content"
android:paddingLeft="22dip" />
<TextView
android:text="Points"
android:background="@color/red"
android:textColor="@color/white"
android:gravity="left"
android:layout_width="wrap_content"
android:paddingRight="18dip"/>
</TableRow>
<TableRow >
<ListView
android:background="@color/white"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
【问题讨论】:
-
如果您的布局没有源代码,任何人都很难为您提供帮助。
-
好的,谢谢,我最初打算添加源代码,但认为对于仅通过查看图片就知道这一点的人来说,我的错误很清楚!
标签: android android-layout android-listview android-xml android-gui