0

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>

主要的.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>
4

2 回答 2

0

我想通了,我不得不删除线性布局中的填充属性,不敢相信我以前没有想通!

于 2012-02-23T10:11:57.590 回答
0

你设置了 android:minHeight 属性以及 LinearLayout 的 android:layout_height 吗?这将修复行高。

于 2012-02-22T23:51:04.667 回答