赞
踩
Android Studio中点击按钮跳转到其他页面:
private Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button1 = (Button) findViewById(R.id.button);// button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setClass(MainActivity.this, Main2Activity.class);//this前面为当前activty名称,class前面为要跳转到得activity名称 startActivity(intent); } }); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。