我正在开发一个应用程序,其中我有一个以下的xml。但是当我尝试清理/构建我的项目时,会发生以下错误:
错误:
Error parsing XML: not well-formed (invalid token)
android:text" associated with an element type "TextView" must not contain the '<' character
布局:
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Hola!_Això_és_una_proba_per_el_treball_de_recerca"
</RelativeLayout>
谢谢!
答案 0 :(得分:0)
您不会关闭<TextView
,因此它会将您的根端标记中的<
视为android:text
的一部分。使用TextView
/>
代码
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Hola!_Això_és_una_proba_per_el_treball_de_recerca"/>
您可能需要清理项目并在执行此操作后再次运行。在Eclipse中
项目 - &gt;清洁...
答案 1 :(得分:0)
您忘记了结束/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Hola!_Això_és_una_proba_per_el_treball_de_recerca" />
答案 2 :(得分:0)
您尚未使用/>
粘贴以下内容代替TextView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Hola!_Això_és_una_proba_per_el_treball_de_recerca"/>