2013-04-27 29 views
0

匹配这是我about.xml文件,该文件是布局文件有关android中xml文件的错误。没有资源的发现,给定名称@Text

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"> 
<TextView android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="@string/about_text" 
android:id="@+id/abouttextview"></TextView> 
</ScrollView> 

这是一个包含了该事项有关按钮被点击时显示的strings.xml文件

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <string name="hello">Hello World, Hangman!</string> 
    <string name="app_name">Android Hangman</string> 
    <string name="about_text">Hangman is the classic game that has 
    players 
    trying to guess their opponent's mystery word first--and 
    before 
    getting hanged. For every wrong letter chosen, a bit more 
    of the hangman is exposed.</string> 
    <string name="about_title">About Android Hangman</string> 
</resources> 

我在使用Android变得错误:about.xml话没有资源发现的文本= @字符串/ about_Text行给定的名字

+0

我检查了你的所有代码,它的工作正常。只需替换特殊字符并将\放在撇号之前。清理你的项目并保存。 – itsrajesh4uguys 2013-04-27 07:04:03

+0

@ itsrajesh4uguys-仍然收到da同样的错误 – 2013-04-27 07:51:54

回答

1

您需要特殊投入\符号匹配strings.xml中的字符。

对手\的

 ^^ 

string.xml

<string name="about_text">Hangman is the classic game that has 
    players 
    trying to guess their opponent\'s mystery word first--and 
    before 
    getting hanged. For every wrong letter chosen, a bit more 
    of the hangman is exposed.</string> 

about.xml

<ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <TextView 
      android:id="@+id/abouttextview" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/about_text" > 
     </TextView> 
    </ScrollView> 

它在我的工作c酶。

+0

你解决了你的问题吗? – 2013-04-27 07:15:18

+0

没有家伙....它没有得到解决..清理大项目。实际上,我点击关于按钮..它应该显示在充气菜单中的strings.xml文件中的文本 – 2013-04-27 07:53:04

+0

意味着字符串不显示? – 2013-04-27 08:46:22

0

我看到的唯一问题是在'撇号字符串资源中的单词opponent's之前缺少\

它改成这样:

<string name="about_text">Hangman is the classic game that has 
players 
trying to guess their opponent\'s mystery word first--and 
before 
getting hanged. For every wrong letter chosen, a bit more 
of the hangman is exposed.</string> 
+0

欢迎你好友。 – 2013-04-27 07:04:51

+0

@Hardik:事实上,事实证明,我没有错过它。 ;-) – 2013-04-27 07:07:15

+0

@Hardik:哈?什么-1?你有2个upvotes和0个downvotes。 – 2013-04-27 07:10:45

0

1)保存所有工作

2)选择该项目,并单击鼠标右键,然后刷新

3)选择项目>清洁

它应该工作

注意:把'/'放在任何特殊字符之前(非字母数字字符)

+0

仍然收到同样的错误@Abd El – 2013-04-27 07:50:50

相关问题