Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 始终显示TableLayout中的最后一列_Android_Android Layout_Android Tablelayout - Fatal编程技术网

Android 始终显示TableLayout中的最后一列

Android 始终显示TableLayout中的最后一列,android,android-layout,android-tablelayout,Android,Android Layout,Android Tablelayout,假设我们的TableLayout有3列,如下所示: 绿色边框表示设备屏幕空间,红色重叠区域表示屏幕后面的空间 因此,我的目标是使第三最正确的一个在特定情况下列优先,并始终充分显示,就像这样: 正如你们现在看到的,第二列已经缩小,为最后一列腾出了空间。有没有关于如何达到这种行为的想法 谢谢 UPD1: 该表的大致基本XML布局可能如下所示: <TableLayout xmlns:android="http://schemas.android.com/apk/res/andro

假设我们的TableLayout有3列,如下所示:

绿色边框表示设备屏幕空间,红色重叠区域表示屏幕后面的空间

因此,我的目标是使第三最正确的一个在特定情况下列优先,并始终充分显示,就像这样:

正如你们现在看到的,第二列已经缩小,为最后一列腾出了空间。有没有关于如何达到这种行为的想法

谢谢

UPD1: 该表的大致基本XML布局可能如下所示:

<TableLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TableRow>
        <TextView
                android:text="header0"
                android:layout_gravity="left"
                android:textStyle="bold"/>
        <TextView
                android:text="header1"
                android:layout_gravity="left"
                android:textStyle="bold"/>
        <TextView
                android:text="header2"
                android:layout_gravity="left"
                android:textStyle="bold"/>
    </TableRow>
    <TableRow>
        <TextView
                android:text="column0_value"
                android:layout_gravity="left"/>
        <TextView
                android:text="column1_value"
                android:layout_gravity="left"/>
        <TextView
                android:text="column2_value"
                android:layout_gravity="left"/>
    </TableRow>
    <!--More rows here-->
</TableLayout>
UDP2
某种解决方案是使用android:shrinkColumns=0,1,这将收缩其他列的内容并显示完整的最后一列。但目标是在最后一列之前显示可能适合的所有列的完整内容。

您可以为此显示您的xml布局吗。在实际情况中,此表是以代码构建的,所以我没有它。但对于一般问题,最好先找到常规xml的解决方案。请发布xml好吗?如果表格字段较宽,可以对其进行加权并包装其内容。@隐喻您在tableLayout中尝试过拉伸列属性吗。看这个问题,它可能会帮助你。