我读了 Hello Android 书,但书中的一个练习有问题。我将代码从书中复制并粘贴到activity_main.xml
(res/layout
)和strings.xml
(res/values
),但我看到的错误是Unparsed aapt error(s)!Check the console for Sudoku.
我用谷歌搜索但我没有回答我阅读了stackoverflow的链接,但我的问题没有解决。
活动主.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>
字符串.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').
我无法解决这个问题。有人可以帮帮我吗?