Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.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 一个xml文件中有多个布局_Android_Android Layout - Fatal编程技术网

Android 一个xml文件中有多个布局

Android 一个xml文件中有多个布局,android,android-layout,Android,Android Layout,一个布局xml文件中是否可能有多个布局 我想要下面这样的东西。我希望这一切都在一个片段中。LinearLayout不能是表行,因为其元素与表中的列不对齐。表行必须是行,以便它们的列对齐。尝试执行此操作时,我在文档元素之后收到一个垃圾解析错误 <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" andro

一个布局xml文件中是否可能有多个布局

我想要下面这样的东西。我希望这一切都在一个片段中。LinearLayout不能是表行,因为其元素与表中的列不对齐。表行必须是行,以便它们的列对齐。尝试执行此操作时,我在文档元素之后收到一个
垃圾
解析错误

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            ----
         />
        <ImageButton
            ----
         />

    <TableRow
        android:id="@+id/tablerow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            ----
         />
        <ImageButton
            ----
         />

    </TableRow>

</TableLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:paddingLeft="16dp"
    android:paddingRight="16dp" >

    <ImageButton
        ----
     />

    <ImageButton
        ----
     />

    <ImageButton
        ----
     />

</LinearLayout>

这样做:

<LinearLayout>
    <TableLayout>
    </TableLayout>
    <LinearLayout>
    </LinearLayout>
</LinearLayout>

这样做:

<LinearLayout>
    <TableLayout>
    </TableLayout>
    <LinearLayout>
    </LinearLayout>
</LinearLayout>

到目前为止,我从您的问题中了解到的是,您希望以表格格式显示包含(n)行的数据。
因此,您可以在“使用列表”视图中使用表布局,然后实现数组适配器或您想要实现的任何东西(同样,这取决于您拥有的数据类型)。

到目前为止,我从您的问题中了解到的是,您想要以表格格式显示数据,其中包含(n)行。
因此,您可以在“使用列表”视图中使用表布局,然后实现数组适配器或任何您想要实现的内容(同样,这取决于您拥有的数据类型)。

是的,您可以在一个xml文件中有多个布局告诉我您想要显示什么?是的,您可以在一个xml文件中有多个布局告诉我您想要显示什么?