我读了Hello Android书,我在书中有一个练习有问题。
我将代码从书本复制并粘贴到activity_main.xml
(res/layout
)和strings.xml
(res/values
),但我看到的错误是Unparsed aapt error(s)!Check the console for Sudoku.
我google了,我不回答我读了stackoverflow的链接,但我的问题没有解决。
activity_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="@string/main_title" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_label" />
</LinearLayout>
的strings.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="exit_label">Exit</string>
</resources>
我阅读了控制台标签,我获得了有关该计划的更多信息:
Bad XML block: header size 91 or total size 0 is larger than data size 0
error: Error: No resource found that matches the given name (at 'title' with value '@string/menu_settings').
我无法解决这个问题。有人可以帮助我吗?
答案 0 :(得分:0)
将其添加到strings.xml:
<string name="menu_settings">Your text</string>
您似乎正在访问未定义的字符串。