2011-07-03 81 views
0
'<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/droid_background"> 
<TextView 
android:layout_height="wrap_content" 
android:gravity="center_horizontal" 
android:text="@string/hello" 
android:textColor="#FFFFFF" 
android:textStyle="bold"/> 

<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" /> 
<Button 
android:drawable="@drawable/toggleSelection" 
android:layout_alignBottom="true" 
android:layout_alignParentLeft="true" /> 
</RelativeLayout> 
</TableLayout>' 

對此沒有什麼好的結論?所有元素都被終止。對?Android XML格式不正確嗎?

回答

3

RelativeLayout已關閉兩次。

<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" /> <!-- here --> 
<Button 
android:drawable="@drawable/toggleSelection" 
android:layout_alignBottom="true" 
android:layout_alignParentLeft="true" /> 
</RelativeLayout>       <!-- and here again --> 
+0

(在的RelativeLayout的閉合支架中卸下/),現在它說按鈕不是沒有很好地形成,並且必須RelativeLayout的跟着一個>或/> – Cataroux

+1

@Cataroux顯示您的新版本的XML文件。 – phlogratos

1

完整XML文件應該是:

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/droid_background"> 
<TextView 
android:layout_height="wrap_content" 
android:gravity="center_horizontal" 
android:text="@string/hello" 
android:textColor="#FFFFFF" 
android:textStyle="bold"/> 
<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<Button 
android:drawable="@drawable/toggleSelection" 
android:layout_alignBottom="true" 
android:layout_alignParentLeft="true" /> 
</RelativeLayout> 
</TableLayout>