1. 程式人生 > >UI_多選框,跳轉。

UI_多選框,跳轉。

//跳轉
	toimageview.setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View v) {
			// 彈框
			Toast.makeText(MainActivity.this, "跳轉成功", Toast.LENGTH_LONG).show();
			//跳轉
			Intent intent = new Intent(MainActivity.this,Second_Activity.class);
			startActivity(intent);
		}
	});
 //多選框
 check1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				if (isChecked) {
					Toast.makeText(MainActivity.this, "籃球", 0).show();
				}
			}
		});
 private void initView() {
	 toimageview = (ImageView) findViewById(R.id.back1);
	 check1 = (CheckBox) findViewById(R.id.check1);
	 check2 = (CheckBox) findViewById(R.id.check2);
}