2015-09-05 54 views
0

我在將表格行拖放到表格佈局時遇到了問題。 以下是代碼。加入錶行在Androidstudio中拖放表格佈局時遇到問題

<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> 

enter image description here

之前 代碼雖然刪除錶行它顯示了象下面

enter image description here

添加錶行的代碼和快照之後低於

<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> 

enter image description here

我不知道我在做什麼錯。請幫忙。

回答

0

當你有一個TableLayout,不要把TableRow裏面從設計工具,而是直接把你的小部件(如TextViewButton等),設計工具將建立你的觀點;)

+0

是的,我觀察到這一點,但在許多教程中,他們也將Tablerow放在桌面上,爲什麼它會導致問題,並增加更多的tablerows? –

+0

也許這個工具有了進化。 Android工作室總是在變化,教程變得老舊並且很快就被棄用了。 – xiaomi