2012-08-31 53 views
0

对不起,我编码一个简单的android计算器,然后它显示XML错误,我已经改变了一些代码,但它不工作。为什么会这样?在我的简单的Android计算器中有一个错误

这是主要的代码

<LinearLayout xmlsn:android ="http://schemas.android.com/apk/res/android" 
xmlns:tools ="http://schemas.android.com/tools" 
android:orientation="vertical" 
android:layou_width="fill_parent" 
android:layou_height="fill_parent" 
android:paddingTop="5dip"> 
<TextView 
android:id="@+id/tv" 
android:layout_width="fill_parent" 
android:layout_height="40dip" 
android:layout_marginLeft="5dip" 
andorid:layout_marginRight="5dip" 
android:background="#FFFFFF" 
android:gravity="center_verticallright" 
android:textColor="#ff0000" 
android:textSize="30dip"> 
</TextView> 
<LinearLayout 
android:orientation="horizontal" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:paddingTop="5dip"> 

然后我得到一个错误的警告:

the erro warning

它说

在该行发现

多个注释:

  • 错误:错误解析XML:通过任一属性规格, “>” 或 “/>” 没有很好地形成(标记无效)

  • 单元类型 “的LinearLayout” 必须遵循的。

感谢

+0

paste th e xml here – jeet

+1

你应该粘贴'xml',图片不清晰 – Sieryuu

+0

@ jeet对不起,我的电脑中的图片非常大 – Winnie

回答

0

嘛。你确定,你已经关闭了你的LinearLayout标签吗? 编辑器找不到标签</LinearLayout>

它应该可能位于布局文件的最底部。

0

我觉得你的TextView可是没有关闭>。就在</textview>上面添加>

您的图片,以小到真正看到它,那么也许你应该只需上传您的代码

+0

我有,很抱歉,我已将主代码放在 – Winnie

0

尽量把

</LinearLayout> 
</LinearLayout> 

在的xml

末和speeling是不正确,应该是android:layout_heightandroid:layou_height 同样与宽度

这样的结果将是

<LinearLayout xmlns:tools="http://schemas.android.com/tools" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:orientation="vertical" 
    android:paddingTop="5dip" 
    xmlsn:android="http://schemas.android.com/apk/res/android" > 

    <TextView 
     android:id="@+id/tv" 
     android:layout_width="fill_parent" 
     android:layout_height="40dip" 
     andorid:layout_marginRight="5dip" 
     android:layout_marginLeft="5dip" 
     android:background="#FFFFFF" 
     android:gravity="center_verticallright" 
     android:textColor="#ff0000" 
     android:textSize="30dip" > 
    </TextView> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:paddingTop="5dip" > 
    </LinearLayout> 

</LinearLayout> 
相关问题