Skip to content

Commit

Permalink
#4 提交实验四代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Eheech committed Mar 27, 2019
1 parent f0fee45 commit 13645d6
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion students/soft1714080902421/Soft1714080902421MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,32 @@
public class Soft1714080902421MainActivity extends AppCompatActivity {
private ImageView imageView = null;
private Button mBtnImageView=null;
private Button mBtnmytree=null;
private Button mBtntreeplant=null;
private Button mBtntotaltime=null;
private Button mBtnsetting=null;

@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.soft_1714080902421_activity);
setContentView(R.layout.activity_main);
mBtnImageView = findViewById(R.id.btn_imageview);
mBtnmytree = findViewById(R.id.btn_mytree);
mBtntreeplant = findViewById(R.id.btn_treeplant);
mBtntotaltime = findViewById(R.id.btn_totaltime);
mBtnsetting = findViewById(R.id.btn_setting);
setOnClickListener();
//根据id找到按钮
}

private void setOnClickListener(){
OnClick onClick = new OnClick();
mBtnImageView.setOnClickListener(onClick);
mBtnmytree.setOnClickListener(onClick);
mBtntreeplant.setOnClickListener(onClick);
mBtntotaltime.setOnClickListener(onClick);
mBtnsetting.setOnClickListener(onClick);
//设置点击事件
}

Expand All @@ -39,6 +52,18 @@ public void onClick(View v){
case R.id.btn_imageview:
intent = new Intent(Soft1714080902421MainActivity.this, ImageViewActivity.class);
break;
case R.id.btn_mytree:
intent = new Intent(Soft1714080902421MainActivity.this, MyTreeActivity.class);
break;
case R.id.btn_treeplant:
intent = new Intent(Soft1714080902421MainActivity.this, TreePlantActivity.class);
break;
case R.id.btn_totaltime:
intent = new Intent(Soft1714080902421MainActivity.this, TotalTimeActivity.class);
break;
case R.id.btn_setting:
intent = new Intent(Soft1714080902421MainActivity.this, SettingActivity.class);
break;
}
startActivity(intent);
}
Expand Down

0 comments on commit 13645d6

Please sign in to comment.