在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总是在不断变化,教程很快就会过时并被弃用。