Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.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
在Androidstudio的表格布局中拖放表格行时遇到问题_Android_Android Studio - Fatal编程技术网

在Androidstudio的表格布局中拖放表格行时遇到问题

在Androidstudio的表格布局中拖放表格行时遇到问题,android,android-studio,Android,Android Studio,我在将表行拖放到表布局时遇到问题。 下面是代码。 添加表行之前的代码 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="200dp" android:paddingLeft

我在将表行拖放到表布局时遇到问题。 下面是代码。 添加表行之前的代码

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="200dp" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    >
</TableLayout>
在删除表行时,它显示如下

添加表行后,代码和快照如下所示

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="200dp" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    >

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent"></TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent"></TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_column="4"></TableRow>
    </TableRow>
</TableLayout>

我不知道我做错了什么。请提供帮助。

当您有一个TableLayout时,不要从设计工具中放入TableRow,而是直接放入您的小部件,如TextView、Button等,设计工具将为您构建视图

是的,我注意到了这一点,但在许多教程中,他们也在放置Tablerow,以及为什么它会导致问题,并添加更多Tablerow??也许该工具得到了改进。Android studio总是在不断变化,教程很快就会过时并被弃用。