读书人

请问一个HelloWorld的有关问题。多谢

发布时间: 2012-09-07 10:38:15 作者: rapoo

请教一个HelloWorld的问题。。。谢谢
大家好,我刚装完了Android的环境,
想测试一个helloworld程序:

package com.yongfeng.helloworld;

import android.app.Activity;
import android.os.Bundle;

public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

结果提示 R can not be resolved.

如果我引入了包:import android.R;

package com.yongfeng.helloworld;

import android.R;
import android.app.Activity;
import android.os.Bundle;

public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

可是R.layout.main仍然报错,请问是不是哪里我没有配置好呢?

谢谢

读书人网 >移动开发

热点推荐