Button 控件
//xml文件:
<Button android:id="@+id/one_but" android:layout_width="200px" android:layout_height="100px" android:layout_x="5px" android:layout_y="5px" android:background="@drawable/accept_button_hover" />
使用:
button.setText("button");
button.setOnTouchListener(backBtnonTouchListener);
button.setOnTouchListener(new Lis());
class Lis implements OnTouchListener
{
public boolean onTouch(View v, MotionEvent event)
{
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
text.setText(R.string.hello);
break;
case MotionEvent.ACTION_UP:
finish();
break;
}
return true;
}
}
简单的界面跳转
Intent intent = new Intent();
intent.putExtra("name", "name"); //跟下一界面传递数据
intent.setClass(Activity01.this, nextActivity.class);
ClassActivity.this.startActivity(intent);
//nextActivity
intent = getIntent();
String name = intent.getStringExtra("name");//获取数据