我是開發者世界,也是eclipse IDE的新手..我試圖創建一個簡單的應用程序,點擊圖片後,點擊的圖片會變得不可見如何讓ImageView在點擊時不可見
這裏的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);
}
}
}
什麼是失敗? – slezica
@uʍopǝpısdn您的名字真的很有創意! –