2012-10-27 21 views
1

我正在学习如何使用Android开发应用程序。在使用XML在Android中构建简单用户界面时出现错误(在根元素之后的文档中的标记必须是良构)

这是构建简单用户界面并面临错误的第一课 根元素之后的文档中的标记必须格式良好。

这里是代码

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientatio="horizonatal" 


    <EditText android:id="@+id/edit_message" 
     android:layout_widthe="wrap_content" 
     android:layout_height="wrap_content" 
     android:hint="@string/edit_message"> 

     <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/button_send"> 
     /> 
</LinearLayout> 

教训是上http://developer.android.com/training/basics/firstapp/building-ui.html

回答

0

看起来仿佛的LinearLayout元素缺少其关闭角撑架。在最终的属性名称和值中似乎也有一些拼写错误。

尝试:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal"> 

你也忘了关闭的EditText元素,并有一个错字在“宽度”。尝试:

<EditText android:id="@+id/edit_message" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:hint="@string/edit_message" /> 
+0

非常感谢您的更正 – ProMech

相关问题