[英]The method setOnClickListener(new View.OnClickListener(){}) is undefined for the type imageButton1
I keep getting this error message and I am not sure what I am supposed to do. 我不断收到此错误消息,但我不确定该怎么做。
The method setOnClickListener(new View.OnClickListener(){})
is undefined for the type imageButton1
未为类型
imageButton1
定义方法setOnClickListener(new View.OnClickListener(){})
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imageButton1 imagebutton1 = (imageButton1) findViewById(R.id.imageButton1);
imageButton1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
ImageView iv = (ImageView) findViewById(R.id.imageview1);
iv.setVisibility(View.VISIBLE);
}
});
Try: 尝试:
ImageButton imageButton1 = (ImageButton) findViewById(R.id.imageButton1);
imageButton1.setOnClickListener ....
ImageButton is the name of the class, imageButton1 the name of your instance of the class. ImageButton是类的名称,imageButton1是您的类的实例的名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.