Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.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_Tablelayout - Fatal编程技术网

如何使用Android TableLayout创建跨多行的布局?

如何使用Android TableLayout创建跨多行的布局?,android,tablelayout,Android,Tablelayout,如何使用tablelayout创建以下布局?列跨越很简单,但我还没有找到任何关于行跨越的明确指导 试试这个。。。您可以使用layout_weight属性来实现您要执行的操作。。 下面的布局将具有上图所示的布局 <?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="verti

如何使用tablelayout创建以下布局?列跨越很简单,但我还没有找到任何关于行跨越的明确指导


试试这个。。。您可以使用layout_weight属性来实现您要执行的操作。。 下面的布局将具有上图所示的布局

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
    <TableLayout android:layout_width="0dip"
        android:layout_weight="2" android:layout_height="fill_parent">
        <TableRow android:layout_width="0dip" android:layout_weight="2"
            android:layout_height="0dip">
            <View android:layout_width="0dip" android:layout_weight="1"
                android:layout_margin="5dip" android:layout_height="fill_parent"
                android:background="#fff"></View>
            <View android:layout_width="0dip" android:layout_weight="1"
                android:background="#eee" android:layout_margin="5dip"
                android:layout_height="fill_parent"></View>
        </TableRow>
        <TableRow android:layout_width="0dip" android:layout_weight="2"
            android:layout_height="0dip">
            <View android:layout_width="0dip" android:layout_weight="1"
                android:background="#eee" android:layout_height="fill_parent"
                android:layout_margin="5dip"></View>
            <View android:layout_width="0dip" android:layout_weight="1"
                android:layout_margin="5dip" android:layout_height="fill_parent"
                android:background="#fff"></View>
        </TableRow>
    </TableLayout>
    <TableLayout android:layout_width="0dip"
        android:layout_weight="1" android:layout_height="fill_parent">
        <TableRow>
            <View android:layout_width="0dip" android:layout_weight="1"
                android:background="#bbb" android:layout_height="fill_parent"></View>
        </TableRow>

    </TableLayout>
</TableRow>

在上面的代码中,将视图替换为您想要的视图