In questo file sono i miei layout i seguenti errori vengono visualizzati in questo codiceErrore: Nessun risorsa trovato che corrisponde al nome dato
error: Error: No resource found that matches the given name (at 'id' with value '@id/question_text_view').
error: Error: No resource found that matches the given name (at 'id' with value '@id/next_button').
questo è il file di layout
<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:id="@id/question_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="24dp"
/>
<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>
<Button
android:id="@id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next_button"
/>
</LinearLayout>
Questo è il mio stringhe. xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">GeoQuiz</string>
<string name="true_button">True</string>
<string name="false_button">False</string>
<string name="correct_toast">Correct</string>
<string name="next_button">Next</string>
<string name="incorrect_toast">Incorrect</string>
<string name="action_settings">Settings</string>
<string name="question_founder">Frank Reed Horton Founded APO on december 25 1947</string>
<string name="question_chief">Willy Wonka was known as a cheif</string>
<string name="question_lady">The first lady that became president in APO was Mary Katz</string>
<string name="question_president">Our current President of the Delta Rho chapter is john dolan</string>
<string name="question_alphabets">Alpha, Beta, Gamma, Delta, Epsilon, Eta, Zeta</string>
</resources>
so che c'è sapere question_text_view sulle corde, ma ho fatto un allineamento nella mia attività che prende tutte le domande mQuestionTextView = (TextView) findViewById (R.id.question_text_view); int question = mQuestionBank [mCurrentIndex] .getQuestion(); mQuestionTextView.setText (domanda); mQuestionBank è una matrice di tutte le domande che mi chiedo getQuestion() è il mio metodo getter per ottenere la questione
e il secondo errore per next_button io non so cosa ho fatto di sbagliato in quanto ho inserito sul strings.xml Qualcuno può per favore aiutarmi
android: id = "@ id/question_text_view" dovrebbe essere Android: id = "@ + id/question_text_view" stesso pulsante Android : id = "@ + id/next_button" – Raghunandan
vedi [Più tipi di risorse] (h ttp: //developer.android.com/guide/topics/resources/more-resources.html#Id) per la definizione dell'ID per Views in xml. dovrai usare ' ' invece di ' ' per inserire l'id nel file strings.xml o puoi creare un file separato come ids.xml –