首页 > 代码库 > Android VIEW

Android VIEW

	protected void onCreate(Bundle savedInstanceState) {		super.onCreate(savedInstanceState);		setContentView(R.layout.activity_main);		textView=(TextView)findViewById(R.id.textView);		button=(Button)findViewById(R.id.button); //获取代表控件的对象		ButtonListener buttonlistenner=new ButtonListener();  //生成监听器对象		button.setOnClickListener(buttonlistenner); //为控件绑定监听器对象						}	@Override	public boolean onCreateOptionsMenu(Menu menu) {		// Inflate the menu; this adds items to the action bar if it is present.		getMenuInflater().inflate(R.menu.main, menu);		return true;	}	class ButtonListener implements OnClickListener{  //实现监听器接口		@Override		public void onClick(View v) {			count++;			textView.setText(count+"");		}

  

Android VIEW