Code example for Button

Methods: setText, setLayoutParams, setOnClickListener

0
		cannelLayout.setLayoutParams(fillWrapParams);
		// cannelLayout.setBackgroundDrawable(BackGroudSeletor.getdrawble("up_bg2x", 
		// getApplication())); 
		cannelLayout.setGravity(LinearLayout.HORIZONTAL);
 
		Button returnBtn = new Button(this);
		String[] pngArray = { "quxiao_btn2x", "quxiao_btn_hover" };
		// returnBtn.setBackgroundDrawable(BackGroudSeletor.createBgByImageIds(pngArray, 
		// getApplication())); 
		returnBtn.setText("取消");
		wrapParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
		wrapParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
		wrapParams.leftMargin = 10;
		wrapParams.topMargin = 10;
		wrapParams.bottomMargin = 10;
 
		returnBtn.setLayoutParams(wrapParams);
		returnBtn.setOnClickListener(new View.OnClickListener() {
 
			@Override 
			public void onClick(View v) {
				// TODO Auto-generated method stub 
				TencentWebAuthActivity.this.finish();