안녕하세요 오랜만입니다.

제가 RelativeLayout에 뷰를 3개를 놓습니다.

하나는 룰이 없고,

하나(X라는 텍스트가 있음)는 레이아웃 가장 오른쪽 끝(ALIGN_PARENT_RIGHT)

하나(날짜가 들어감)는 바로 위 뷰의 왼쪽(LEFT_OF)

그런데 이게 if문 안에서 하면 제대로 안먹고

밖에서 하면 제대로 적용이 됩니다.


아래 소스는 제대로 안되는 경우입니다.

현상은 if문에서 X버튼을 생성하고 아래와 같이 했을 경우

날짜와 X버튼이 겹쳐나옵니다.

그런데 if문을 벗겨내면 X버튼 왼쪽에 날짜가 잘 나옵니다.

제가 뭘 잘못했습니까... =_=? ㅠㅠㅠㅠㅠㅠ


 if (GlobalMethod.getEncryptedAccount(this).equals(contentData.get("id"))) {
	    		Button deleteButton = new Button(this);
		    	deleteButton.setText("X");
		    	deleteButton.setTextColor(Color.WHITE);
		    	deleteButton.setTypeface(null, Typeface.BOLD);
		    	deleteButton.setBackgroundColor(Color.TRANSPARENT);
		    	deleteButton.setPadding(GlobalData.dip(this, 10), GlobalData.dip(this, 5), GlobalData.dip(this, 10), GlobalData.dip(this, 5));
		    	deleteButton.setId(deleteId);
		    	deleteButton.setLayoutParams(deleteParam);
		    	qTitleContainer.addView(deleteButton);
		    	timeParam.addRule(RelativeLayout.LEFT_OF, deleteId++);
	    	} else {
	    		timeParam.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	    	}


	    	TextView counselTime = new TextView(this);
	    	counselTime.setTextColor(getResources().getColor(R.color.white));
	    	counselTime.setText(Html.fromHtml("<b>" + contentData.get("datetime") + " </b>"));
	    	counselTime.setLayoutParams(timeParam);
	    	qTitleContainer.addView(counselTime);


deleteButton이 X 버튼이고

counselTime이 날짜(0000-00-00 00:00:00)TextView이고

qTitleContainer가 부모인 RelativeLayout입니다.

lifecluee@gmail.com