2016-07-22 24 views
0

我的佈局工作正常時,突然它開始給了我這個例外:行索引(啓動+跨度)不得超過該行數例外的Android

row indices (start + span) mustn't exceed the row count

即使我從頭開始,並再次創建我的佈局我仍然得到這個錯誤。

這裏是我的代碼:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="sign up" 
     android:id="@+id/textView_sign_up_header" 
     android:gravity="center" 
     android:background="@color/colorPrimary" 
     android:textColor="#FFF"/> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <GridLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:columnCount="2" 
      android:rowCount="6" 
      android:useDefaultMargins="true"> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_column="0" 
       android:layout_columnSpan="2" 
       android:layout_row="0" 
       android:layoutDirection="rtl" 
       android:layout_margin="@dimen/activity_vertical_margin"> 

       <android.support.design.widget.TextInputLayout 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1" 
        android:layout_gravity="center"> 

        <android.support.design.widget.TextInputEditText 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/editText_first_name" 
         android:hint="name" 
         android:layout_gravity="right" 
         android:textDirection="rtl" 
         android:textSize="@dimen/global_edit_text_size"/> 

       </android.support.design.widget.TextInputLayout> 

       <android.support.design.widget.TextInputLayout 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1" 
        android:layout_gravity="center"> 

        <android.support.design.widget.TextInputEditText 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/editText_last_name" 
         android:hint="last name" 
         android:layout_gravity="right" 
         android:textDirection="rtl" 
         android:textSize="@dimen/global_edit_text_size"/> 

       </android.support.design.widget.TextInputLayout> 

      </LinearLayout> 
     </GridLayout> 
    </ScrollView> 
</LinearLayout> 

我不知道哪裏出了問題,因爲我有相同的代碼,它工作正常

回答

0

也許你columCount或rowCount時是不夠的。