Cataroux
Cataroux

Reputation: 147

Android XML not well formed?

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

Whats not well-formed about this? All elements are terminated. right?

Upvotes: 0

Views: 1476

Answers (2)

Joyce
Joyce

Reputation: 447

The full XML file should be: (Remove the / at the closing bracket of RelativeLayout)

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

Upvotes: 1

phlogratos
phlogratos

Reputation: 13924

RelativeLayout is closed twice.

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

Upvotes: 3

Related Questions