开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜