Androidアプリの開発者として新しい私は問題を見つける。 R.layout.mainは解決できません。どのようにして私の問題を解決することができますか私のコードはここにあります。私の問題を解決してください。R.layout.mainを解決するにはどうすればよいですか?アンドロイドアプリで解決できませんか?
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);
}
});
}
}
*
と私の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/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>
削除インポート 'android.R;'とプレス上記のコメントの他に、アプリケーションでR –
をインポートするには、 'CTRL + SHIFT + O'を押して、Eclipseでプロジェクトをクリーンアップして、もう一度ビルドしてください。この質問は結局のところ複製されていません – quinestor
これは何百回も返答されています..あなたが尋ねる前にgoogleをお願いします – krilovich