안드로이드 개발 질문/답변
(글 수 45,052)
//레이아웃 생성
LinearLayout layout = new LinearLayout(this);
layout.setBackgroundColor(Color.rgb(255,255,255));
layout.setOrientation(LinearLayout.VERTICAL);
setContentView(layout);
//버튼 생성
button = new Button(this);
button.setText("버튼");
button.setOnClickListener(this);
setLLParams(button);
layout.addView(button);
layout.setGravity(200);
// 질문 1 버튼의 좌표를 지정하려고 하는데요, 아래처럼 하면 프로그램이 죽더군요. -.-
// button.layout(10, 10, 10, 10);
버튼에 좌표를 부여하려면 어떻게 해야 하나요?



Button setLayoutParams( params ) API를 사용해 보세요.