Ich bin neu als Entwickler von Android-Apps. Ich finde ein Problem. das ist R.layout.main kann nicht aufgelöst werden. Wie kann ich mein Problem lösen? Mein Code ist hier. Bitte löse mein Problem.Wie kann ich lösen R.layout.main kann nicht in meinen Android-Apps gelöst werden?
package com.android;
import android.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class HelloActivity extends Activity {
/** Called when the activity is first created. */
Button bt;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt=(Button)findViewById(R.id.ButtonOk);
bt.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//Toast.makeText(getBaseContext(), "Welcome Android World", 3000).show();
Intent intent = new Intent(HelloActivity.this, DisplayActivity.class);
startActivity(intent);
}
});
}
}
*
und mein xml-Code ist hier:
*
<?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/hello"
/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ok" android:id="@+id/ButtonOk" android:height="50dp" android:width="100dp"></Button>
</LinearLayout>
entfernen Import 'android.R;' und drücken 'STRG + UMSCHALTTASTE + O' zum Importieren Ihrer Anwendung R –
Neben dem obigen Kommentar, bereinigen Sie das Projekt in Eclipse und bauen Sie es erneut auf. Diese Frage ist ein unendliches Duplikat – quinestor
das wurde hundert Mal beantwortet .. bitte google bevor Sie fragen – krilovich