我的 android xml 文件有错误。
error: Error parsing XML: not well-formed (invalid token).
我的 xml 代码是:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="105dp"
android:background="@drawable/white"
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="6"
android:minLines="6"
android:gravity="top|left"
android:maxLines="10"
android:scrollbars="vertical"
android:hint="Comments on my post"
<requestFocus />
</EditText>
</RelativeLayout>
最佳答案
您的 RelativeLayout
中缺少以下命名空间和右括号 (>)。
xmlns:android="http://schemas.android.com/apk/res/android"
因此,将它们添加到 RelativeLayout
...如下...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="105dp"
android:background="@drawable/white">
您还缺少 EditText
的右括号 (>
)...将右括号添加为...
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="6"
android:minLines="6"
android:gravity="top|left"
android:maxLines="10"
android:scrollbars="vertical"
android:hint="Comments on my post">
然后清理
并构建
您的项目。
关于安卓错误 : Error parsing XML: not well-formed (invalid token),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21872691/