【发布时间】:2009-12-29 02:18:49
【问题描述】:
我正在编写一个简单的“hello world”教程,然后将其修改为我想要的应用程序。我从一个 hello world 应用开始,添加了一个按钮,现在我正在尝试响应按钮事件等。
但是当我编译时出现错误:“package andriod.widget does not exist \n import andriod.widget.Button;”
代码是
package com.luke.bowls;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import andriod.widget.Button;
public class Bowls extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button = (Button)findViewById(R.id.android_button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Perform action on clicks
}
});
}
}
这看起来像是一个库引用问题,但大部分构建代码对我来说是隐藏的,所以我不知道如何修复它。
【问题讨论】: