0

错误:解析 XML 时出错:文档元素后出现垃圾

我正在做一个非常基本的代码,只是为了变得更好。

<?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:orientation="vertical">





<textview
        android:layout_width="1dp"
        android:layout_weight="0dp"
        android:layout_height="175dp"
        android:text="@string/welcome_app"
        android:text="@string/action_settings" ></textview>




</LinearLayout>
4

3 回答 3

1

不允许在 TextView 标记的末尾有空格。

  1. 去掉标签末尾的“”。
  2. 替换<textview><TextView>

这应该有效:

<TextView
    android:layout_width="1dp"
    android:layout_height="175dp"
    android:text="@string/action_settings"/>
于 2013-09-08T03:47:42.273 回答
0
// I Modify your code now try it.
<?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:orientation="vertical" >

    <TextView
        android:layout_width="1dp"
        android:layout_height="175dp"
        android:text="@string/welcome_app" >
    </TextView>

</LinearLayout>
于 2013-09-09T04:00:31.467 回答
0

标签区分大小写,因此请使用:

<Textview
    android:layout_width="1dp"
    android:layout_weight="0dp"
    android:layout_height="175dp"
    android:text="@string/welcome_app"
    android:text="@string/action_settings" >
</Textview>
于 2013-09-09T12:44:38.167 回答