gpt4 book ai didi

java - 错误没有与给定名称匹配的资源(在 "label"处,值为 "@string/about_title"

转载 作者:太空狗 更新时间:2023-10-29 16:24:59 24 4
gpt4 key购买 nike

大家好,我正在学习 Hello Android 3ed 版中的数独教程,但我无法摆脱这个错误,这是我的文件

list .xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.example.sudoku"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Sudoku"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".About"
android:label="@string/about_title" >
</activity>


</application>
<uses-sdk android:minSdkVersion="8" />

</manifest>

字符串.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Sudoku</string>
<string name="main_title">Android Sudoku</string>
<string name="continue_label">Continue</string>
<string name="new_game_label">New Game</string>
<string name="about_label">About</string>
<string name="about_text">\
Sudoku is a logic-based number placement puzzle.
Starting with a partially completed 9x9 grid, the
objective is to fill the grid so that each row,
each column, and each of the 3x3 boxes contains
the digits
1 to 9 exactly once.
</string>
<string name="exit_label">Exit</string>
</resources>

关于.xml

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

最佳答案

好吧,错误说明了一切。您正在引用 ID 为 about_title 的字符串,但此类字符串未在 strings.xml 中定义。或许,您可以将其更改为 about_label,它确实已定义。

关于java - 错误没有与给定名称匹配的资源(在 "label"处,值为 "@string/about_title",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4255453/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com