Android,在TableLayout中设置列大小

Android,在TableLayout中设置列大小,android,tablelayout,Android,Tablelayout,所以,我通过膨胀布局文件从代码创建TableLayout。我试图让第一行跨越两列,下一行包含两个文本视图:key和value。问题是这个值可能很长,所以我在TableLayout xml中使用设置android:stretchColumns,android:shrinkColumns。现在键列和值列看起来很好,但首先,跨距,标题比屏幕大 我的文件的当前情况如下所示: tale_row.xml: <TableRow xmlns:android="http://schemas.android

所以,我通过膨胀布局文件从代码创建TableLayout。我试图让第一行跨越两列,下一行包含两个文本视图:key和value。问题是这个值可能很长,所以我在TableLayout xml中使用设置
android:stretchColumns
android:shrinkColumns
。现在键列和值列看起来很好,但首先,跨距,标题比屏幕大

我的文件的当前情况如下所示:

tale_row.xml:

 <TableRow xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingTop="5dp"
     android:paddingBottom="5dp"
     android:paddingLeft="10dp"
     android:paddingRight="10dp" >
        <TextView 
            android:id="@+id/key"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/gray"
            android:textStyle="bold"
            android:layout_marginRight="10dp" />
        <TextView 
            android:id="@+id/value"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@android:color/black" />"
 </TableRow>

"
header_row.xml:

<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView 
        android:id="@+id/header"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_span="2"
        style="@style/group_separator_style"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp" />

</TableRow>

table.xml:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1" >
</TableLayout>


任何想法,原因可能是什么?将属性
clipChildren
ClipPadding
设置为true没有帮助。

看起来像是设置了
android:stretchColumns=“1”
android:shrinkColumns=“1”
解决了这个问题“不幸的是,在头球中,这没有帮助