-1

こんにちは、アクティビティでエラーが発生しました。エラーが 6 行目に表示される理由がわかりません。

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="24dp"
    android:text="@string/question_text"
     />
<LinearLayout 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" 
    <Button 
        android:id="@+id/true_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/true_button"
        />
    <Button 
        android:id="@+id/false_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/false_button"
        />

    </LinearLayout>

</LinearLayout>

ここに私のstrings.xmlがあります

<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">GeoQuiz</string>
<string name="question_text">Constantinople is the largest city in turkey</string>
<string name="true_button">True</string>
<string name="false_button">False</string>
<string name="action_settings">Settings</string>
</resources>'

そして、これが私の他の自動生成されたxmlファイルです

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/action_settings"/>

</menu>

このファイルの 5 行目にエラーが表示されます。エラー: エラー: 指定された名前に一致するリソースが見つかりません ('title' で値 '@string/action_settings')。

どうすればこれを修正できますか ありがとう

4

3 に答える 3

1

リニア レイアウト タグを > で閉じていません。そのため、最初のタグの末尾が見つかりません。

于 2013-05-19T05:07:23.543 に答える
1

こちらの回答を参照してください: https://stackoverflow.com/a/16631008/1306419。そこから有用な情報を抽出してみてください。

次のようなものを試してください:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">
...
...
</LinearLayout>

注:<LinearLayoutタグを開始したときに>、最後に使用したこと。それが役に立てば幸い。

于 2013-05-19T05:09:24.700 に答える
0

私はあなたが私の最初の答えを得たとは思わない。これを正確に試してください:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="24dp"
        android:text="@string/question_text"
        />
    <LinearLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >
        <Button 
            android:id="@+id/true_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/true_button"
        />
        <Button 
            android:id="@+id/false_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/false_button"
        />
    </LinearLayout>
</LinearLayout>
于 2013-05-19T05:12:56.643 に答える