2011-12-26 102 views
0

我是一个初学者编码器,试图学习如何使android应用程序。我正在使用these tutorials,我想我遇到了一个错误。Android Java编码错误,需要帮助

这里是我的text.xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:padding="25dp" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<EditText 
android:id="@+id/etCommands" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:hint="Type a command" 
android:password="true" /> 

<LinearLayout 
android:weightSum="100" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" 

<Button 
    android:layout_weight="20" 
    android:id="@+id/Bresults" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Button" /> 



<ToggleButton 
android:layout_weight="80" 
android:id="@+id/tbPassword" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="ToggleButton" 
android:checked="true" /> 

</LinearLayout> 

<TextView 
android:id="@+id/tvresults" 
android:paddingBottom="10dp" 
android:checked="true" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:gravity="center" 
android:text="invalid" /> 

</LinearLayout> 

我得到一个错误下一那里说按钮。错误说:

Multiple annotations found at this line: - Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>". - error:error parsing XML:not well-formed (invalid token)"

回答

1

您需要关闭该标签上的第二线性布局>

<LinearLayout 
android:weightSum="100" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal"> <!-- here --> 
+0

嘿,这就解决了整个问题。谢啦!!! – Alex 2011-12-26 02:12:41

0

的colorcoding在您的文章已经凸显的问题。在LinearLayout开始标记后忘记了>

+0

嘿,这就解决了整个问题。谢啦!!! – Alex 2011-12-26 02:12:47

+0

看着颜色总是有帮助。在这种情况下,他们只是变黑了。 – 2011-12-26 02:13:30

+0

是的,我现在看到它。日食软件没有让它变成黑色。但尽快回复。 – Alex 2011-12-26 02:21:25