안드로이드 개발 질문/답변
(글 수 45,052)
우선 저는 XML 사용 안합니다.
코드로 다 개발하고 있고..
아래와 같이 구현을 했는데 죽어라 버튼이 좌측상단에만 붙어있네요 (미워죽겠네요)
아래 코드에서 어떻게하면 제가 지정한 위치로 버튼이 이동을 할까요?
고수님들의 답변을 기다립니다.
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
Button closeButton = new Button(this);
closeButton.setBackgroundColor(0);
buttonPosition = ((deviceWidth-mAdSizeWidth)/2)+mAdSizeWidth;
topMargin = (deviceHeight - (deviceHeight-mAdSizeHeight))/10;
closeButton.setPadding(buttonPosition ,10, 0, 0);
closeButton.setBackgroundResource(R.drawable.close_button);
lp.width=50;
lp.height=50;
this.addContentView(closeButton, lp);



