2016-12-18 101 views
0

我有一個簡單的Xamarin佈局,無法正確呈現。行(4,5,6)上有多個只包含單個UI元素的列。這是XML。根據其他SO帖子,設置layout_span=2應該可以解決問題。但它似乎並不奏效。Xamarin Android佈局問題

<?xml version="1.0" encoding="utf-8"?> 
 
<TableLayout xmlns:p1="http://schemas.android.com/apk/res/android" 
 
    p1:minWidth="25px" 
 
    p1:minHeight="25px" 
 
    p1:layout_width="match_parent" 
 
    p1:layout_height="match_parent" 
 
    p1:id="@+id/tableLayout1"> 
 
    <TableRow 
 
     p1:id="@+id/tableRow1" 
 
     p1:layout_width="match_parent" 
 
     p1:gravity="center_horizontal" 
 
     p1:layout_weight="1"> 
 
     <TextView 
 
      p1:text="Image Path" 
 
      p1:textAppearance="?android:attr/textAppearanceLarge" 
 
      p1:id="@+id/pathLabel" /> 
 
     <EditText 
 
      p1:inputType="text" 
 
      p1:id="@+id/imagePathText" 
 
      p1:layout_weight="1" /> 
 
    </TableRow> 
 
    <TableRow 
 
     p1:id="@+id/tableRow5"> 
 
     <TextView 
 
      p1:text="Server Path" 
 
      p1:textAppearance="?android:attr/textAppearanceLarge" 
 
      p1:id="@+id/textView10" 
 
      p1:layout_column="0" /> 
 
     <EditText 
 
      p1:id="@+id/serverPathText" 
 
      p1:layout_column="1" 
 
      p1:layout_weight="1" /> 
 
    </TableRow> 
 
    <TableRow 
 
     p1:id="@+id/tableRow2" 
 
     p1:minWidth="25px" 
 
     p1:minHeight="25px" 
 
     p1:gravity="center_horizontal" 
 
     p1:layout_width="match_parent" 
 
     p1:layout_weight="1"> 
 
     <TextView 
 
      p1:text="Start Date" 
 
      p1:textAppearance="?android:attr/textAppearanceLarge" 
 
      p1:id="@+id/dateLabel" /> 
 
     <EditText 
 
      p1:inputType="date" 
 
      p1:id="@+id/dateText" 
 
      p1:layout_weight="1" /> 
 
    </TableRow> 
 
    <TableRow 
 
     p1:id="@+id/tableRow6"> 
 
     <Button 
 
      p1:text="Save" 
 
      p1:id="@+id/saveButton" 
 
      p1:layout_column="0" 
 
      p1:layout_weight="1" 
 
      p1:layout_width="match_parent" 
 
      p1:layout_span="2" /> 
 
    </TableRow> 
 
    <TableRow 
 
     p1:id="@+id/tableRow3" 
 
     p1:minWidth="25px" 
 
     p1:minHeight="25px" 
 
     p1:layout_weight="100"> 
 
     <TextView 
 
      p1:text="Text" 
 
      p1:id="@+id/logView" 
 
      p1:layout_width="match_parent" 
 
      p1:layout_height="match_parent" 
 
      p1:layout_weight="1" 
 
      p1:layout_span="2" /> 
 
    </TableRow> 
 
    <TableRow 
 
     p1:minWidth="25px" 
 
     p1:minHeight="25px" 
 
     p1:id="@+id/tableRow4" 
 
     p1:layout_weight="1"> 
 
     <Button 
 
      p1:layout_column="0" 
 
      p1:id="@+id/syncButton" 
 
      p1:text="@string/sync" 
 
      p1:layout_width="match_parent" 
 
      p1:layout_weight="1" 
 
      p1:layout_span="2" /> 
 
    </TableRow> 
 
</TableLayout>

Screenshot

回答

1

我檢查你的代碼,它是正確的。

嘗試關閉/打開IDE,從設備上刪除應用程序並重新構建項目。

enter image description here

+0

令人驚訝的是工作。我做了一個「清潔解決方案」,然後是「構建解決方案」。什麼菜鳥的錯誤。謝謝。 – Rick