开发者

Android XML not well formed?

开发者 https://www.devze.com 2023-03-16 19:54 出处:网络
\'<?xml version=\"1.0\" encoding=\"utf-8\"?> <TableLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
'<?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 te开发者_JAVA技巧rminated. right?


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


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

精彩评论

暂无评论...
验证码 换一张
取 消