我是开发人员世界的新手,也是 eclipse IDE 的新手。我正在尝试创建一个简单的应用程序,当您单击图像时,单击的图像将变得不可见
这是java代码:
package com.example.capstone;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
public class Levelone extends Activity implements OnClickListener
{
Button nextlevel;
Button Main;
ImageButton eagle;
protected void onCreate(Bundle onSavedInstanceState) {
super.onCreate(onSavedInstanceState);
setContentView(R.layout.levelone);
nextlevel = (Button)findViewById(R.id.btnNextlvl);
nextlevel.setOnClickListener(this);
Main = (Button)findViewById(R.id.btnMain);
Main.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(arg0.getId()==R.id.imgEagle)
{
eagle = (ImageButton)findViewById(R.id.imgEagle);
eagle.setVisibility(View.GONE);
}
}
}