Android应用程序:错误"找到文本"

Tas*_*han 3 xml android image

我一直在关注Android"开始Android应用程序"的书.我一直试图找出一个在视图中显示图像的应用程序.但遗憾的是,由于以下错误,我无法运行该应用程序:

[2012-04-24 19:37:33 - Gallery] F:\eclipse workspace\Gallery\res\values 
\attrs.xml:2:error: Found text "
[2012-04-24 19:37:33 - Gallery] ​​​​    " where item tag is expected
Run Code Online (Sandbox Code Playgroud)

为方便起见,我在这里给出了代码.main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView  
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="Bilai"
/>
<Gallery
android:id="@+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>    
<ImageView
android:id="@+id/image1"
android:layout_width="320px"
android:layout_height="250px"
android:scaleType="fitXY"
/>  
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

此应用程序需要另一个xml文件.它在res/values下命名为attrs.xml.attrs.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
?<declare-styleable name="Gallery1" >
????<attr name="android:galleryItemBackground" />
???</declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)

我认为问题出在attrs.xml中,但我不知道发生了什么.因此,R.styleable也不起作用.请帮忙.提前致谢

小智 5

我认为由于复制/过去方法,你在attrs.xml中的每一行之前都有一些字符.

您可以尝试通过将文本光标放在每行的开头重新格式化代码并删除以返回上一行吗?